Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
CPP All : Creating and Using Class Objects


Exam Papers Problems

Output writing parameterized class methods #5619

( As In Exam - CBSE12A-2016 )

Find and write the output of the following C++ program code:
Note: Assu

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Share
 {
 long int Code;
 float Rate;
 int DD;
 public:
 Share(){Code=1000;Rate=100;DD=1;}
 void GetCode(long int C,float R)
 {
  Code=C;
  Rate=R;
 }
 void Update(int Change,int D)
 {
  Rate+=Change;
  DD=D;
 }
 void Status()
 {
  cout<<"Date:"<<DD<<endl;
  cout<<Code<<"#"<<Rate<<endl;
 }
};
void main()
{
 Share S,T,U;
 S.GetCode(1324,350);
 T.GetCode(1435,250);
 S.Update(50,28);
 U.Update(25,26);
 S.Status();
 T.Status();
 U.Status();
}

01E #5837

( As In Exam - CBSE12D-2015 )

Write the output of the following C++ program code:
Note: Assume all th

Write the output of the following C++ program code:
Note: Assume all the required header files are already being included in the program.

class Calc
{
  char Grade;
  int Bonus;
public:
  Calc(){Grade='E' ; Bonus=0;}
  void Down(int G)
  {
  Grade-=G;
  }
  Void Up(int G)
  {
    Grade+=G;
    Bonus++;
  }
  void Show()
  {
    cout<<Grade<<"#"<<Bonus<<end1;
  }
};
void main()
{
  Calc c;
  C.Down(2);
  C.Show();
  C.Up(7);
  C.Show();
  C.Down(2)
  C.Show();
}

02B #5848

( As In Exam - CBSE12D-2015 )

Observe the following C++ code and answer the questions (i) and (ii) :

Observe the following C++ code and answer the questions (i) and (ii) :

class Traveller
{
  long PNR;
  char TName[20];
public :
  Traveller()                  //Function 1
  {cout<<"Ready"<<endl;}
  void Book(long P,char N[])   //Function 2
  {PNR = P; strcpy(TName, N);}
  void Print()                 //Function 3
  {cout<<PNR << TName <<endl;}
  ~Traveller()                 //Function 4
  {cout<<"Booking cancelled!"<<endl;}
};

(i) Fill in the blank statements in Line 1 and Line 2 to execute Function 2 and Function 3 respectively in the following code:

v oid main{)
{
  Traveller T;
  _____________ //Line 1
  _____________ //Line 2
}//Stops here

(ii) Which function will be executed at }//Stops here? What is this
function referred as ?

01E-2015 #5938

( As In Exam - CBSE12A-2015 )

Write the output of the following C++ program code:
Note: Assume all re

Write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Eval
{
  char Level;
  int Point;
public:
  Eval() {Level='E';Point=0;}
  void Sink(int L)
{
  Level=L;
}
void Float(int L)
{
  Level += L;
  Point++;
}
void Show()
{
  cout<<Level<<"#"<<Point<<endl;
}
};
void main()
{
  Eval E;
  E.Sink(3);
  E.Show();
  E.Float(7);
  E.Show();
  E.Sink(2);
  E.Show();
}

01E-2016 #6085

( As In Exam - CBSE12D-2016 )

Find and write the output of the following C++ program code:
Note: Assu

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.

class Stock
{
  long int ID;
  float Rate; int Date;
  public:
  Stock(){ID=1001;Rate=200;Date=1;}
  void RegCode(long int I,float R)
  {
    ID=I; Rate=R;
  }
  void Change(int New,int DT)
  {
    Rate+=New; Date=DT;
  }
  void Show()
  {
    cout<<”Date :”<<Date<<endl;
    cout<<ID<<”#”<<Rate<<endl;
  }
};
void main()
{
  Stock A,B,C;
  A.RegCode(1024,150);
  B.RegCode(2015,300);
  B.Change(100,29);
  C.Change(20,20);
  A.Show();
  B.Show();
  C.Show();
}



Exam Paper Problems:5 
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning 2D Array Memory Addressing Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back