Questions – Exam Papers – Computer Sir Ki Class

Login


Lost your password?

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


Shop
siteicon
Question Typewise Collection-"Theory Concepts" Questions - Exam Papers (CPP) No. of Q.20

Answer the questions (i) to (iv) based on the following:

class Shape
{
  int length;
protected:
  int width,height;
public:
  Shape();
  void getDimension(int,int,int); void dispDimension();
};
class SideShape : protected Shape
{
  int SideLength,SideWidth;
protected:
  void getSide(int,int);
public:
  SideShape();
  void dispSide();
};
class SubShape : public SideShape
{
  int subLength;
  void display();
public:
  SubShape();
  void enter();
};

(i) Name the base class and derived class of SideShape
(ii) Write the name(s) of all the data members that can be accessed from function dispSide().
(iii) Write the name(s) of private member functions of class SubShape.
(iv) Write the names of all the member functions accessible from object of class SubShape.



Q.2   Exam - CBSE12D-2016/02D/4

Answer the questions (i) to (iv) based on the following:

class PRODUCT
{
  int Code;
  char Item[20];
protected:
  float Qty;
public:
  PRODUCT();
  void GetIn(); void Show();
};
class WHOLESALER
{
  int WCode;
protected:
  char Manager[20];
public:
  WHOLESALER();
  void Enter();
  void Display();
};
class SHOWROOM : public PRODUCT, private WHOLESALER
{
  char Name[20],City[20];
public:
  SHOWROOM();
  void Input();
  void View();
};

(i) Which type of Inheritance out of the following is illustrated in the above example?
– Single Level Inheritance
– Multi Level Inheritance
– Multiple Inheritance
(ii) Write the names of all the data members, which are directly accessible from the
member functions of class SHOWROOM.
(iii) Write the names of all the member functions, which are directly accessible by an
object of class SHOWROOM.
(iv) What will be the order of execution of the constructors, when an object of class
SHOWROOM is declared?



Q.3   Exam - CBSE12D-2016/02B/2

Observe the following C++ code and answer the questions (i) and (ii). Assume all necessary files are included:

class FICTION
{
  long FCode;
  char FTitle[20];
  float FPrice;
public:
  FICTION() //Member Function 1
  {
    cout<<”Bought”<<endl;
    FCode=100;strcpy(FTitle,”Noname”);FPrice=50;
  }
  FICTION(int C,char T[],float P) //Member Function 2
  {
    FCode=C;
    strcpy(FTitle,T);
    FPrice=P;
  }
  void Increase(float P) //Member Function 3
  {
    FPrice+=P;
  }
  void Show()           //Member Function 4
  {
    cout<<FCode<<”:”<<FTitle<<”:”<<FPrice<<endl;
  }
  ~FICTION()            //Member Function 5
  {
    cout<<”Fiction removed!”<<end1;
  }
};
void main()                          //Line 1
{                                    //Line 2
  FICTION F1,F2(101,”Dare”,75);      //Line 3
  for (int I=0;I<4;I++)              //Line 4
  {                                  //Line 5
    F1.Increase(20);F2.Increase(15); //Line 6
    F1.Show();F2.Show();             //Line 7
  }                                  //Line 8
}                                    //Line 9

(i) Which specific concept of object oriented programming out of the following is illustrated by Member Function 1 and Member Function 2 combined together?
– Data Encapsulation
– Data Hiding
- Polymorphism
– Inheritance

(ii) How many times the message ”Fiction removed!” will be displayed after executing the above C++ code? Out of Line 1 to Line 9, which line is responsible to display the message “Fiction removed!”?



Q.4   Exam - CBSE12D-2016/02A/2

Differentiate between Constructor and Destructor functions giving suitable example using a class in C++. When does each of them execute?



Q.5   Exam - CBSE12D-2017/03E/2

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
P + ( Q – R ) * S / T



Q.6   Exam - CBSE12D-2017/03C/3

T[25][30] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 2 bytes, find the address of the element T[10][15], if the element T[5][10] is stored at the memory location 25000.



Q.7   Exam - CBSE12A-2015/03E/2

Convert the following infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
U * V + R/ (S-T)



Q.8   Exam - CBSE12A-2015/03B/3

A two dimensional array ARR[50][20] is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[30][10], if the element ARR[10] [5] is stored at the memory location 15000.



Q.9   Exam - CBSE12D-2015/03E/2

Convert the following infix expression to its equivalent postfix expression, showing the stack contents for each step of conversion.
X / Y + U* (V-W)



Q.10   Exam - CBSE12D-2015/03B/3

A two dimensional array P[20] [50] is stored in the memory along the row with each of its element occupying 4 bytes, find the address of the element P[10] [30],if the element P[5] [5] is stored at the memory location 15000.



Q.11   Exam - CBSE12D-2015/02D/4

Answer the question (i) to (iv) based on the following:

class Exterior
{
  int OrderId;
  char Address[20];
protected:
  float Advance;
  public:
  Exterior();
  void Book(); 
  void View();
};
class Paint:public Exterior
{
  int WallArea,ColorCode;
protected:
  char Type;
public:
  Paint() ;
  void PBook();
  void PView();
};
class Bill:public Paint
{
  float Charges;
  void Calculate();
public:
  Bill() ;
  void Billing() ;
  void Print() ;
};

(i) Which type of Inheritance out of the following is illustrated in the above example?
-Single Level Inheritance
-Multi Level Inheritance
-Multiple Inheritance

(ii) Write the names of all the data members, which are directly accessible from the member functions of class Paint.

(iii) Write the names of all the member functions, which are directly accessible from an object of class Bill.

(iv) What will be the order of execution of the constructors, when an object of class Bill is declared?



Q.12   Exam - CBSE12D-2015/02A/2

What is a copy constructor? Give a suitable example in C++ to illustrate with its definition within a class and a declaration of an object with the help of it .



Q.13   Exam - CBSE12A-2017/03E/2

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:
X – ( Y + Z ) / U * V



Q.14   Exam - CBSE12A-2017/03C/3

ARR[15][20] is a two-dimensional array, which is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[5][15], if the element ARR[10][5] is stored at the memory location 35000.



Q.15   Exam - CBSE12A-2017/02D/4

Answer the questions (i) to (iv) based on the following:

class First
{
  int X1;
protected:
  float X2;
public:
  First();
  void Enter1(); void Display1();
};
class Second : private First
{
  int Y1;
protected:
  float Y2;
public:
  Second();
  void Enter2();
  void Display();
};
class Third : public Second
{
  int Z1;
public:
  Third();
  void Enter3();
  void Display();
};
void main()
{
  Third T;           //Statement 1
__________________;  //Statement 2
}

(i) Which type of Inheritance out of the following is illustrated in the above example? Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance

(ii) Write the names of all the member functions, which are directly accessible by the object T of class Third as declared in main() function.

(iii) Write Statement 2 to call function Display() of class Second from the object T of class Third.

(iv) What will be the order of execution of the constructors, when the object T of class Third is declared inside main()?



Q.16   Exam - CBSE12A-2017/02A/2

Differentiate between protected and private members of a class in context of Object Oriented Programming. Also give a suitable example illustrating accessibility/non-accessibility of each using a class and an object in C++.



Q.17   Exam - CBSE12A-2018/03E/2

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:
U * V + (W – Z) / X



Q.18   Exam - CBSE12A-2016/03E/2

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.

P/(QR)*S+T



Q.19   Exam - CBSE12A-2016/03B/3

R[10][50] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 8 bytes, find the address of the element R[5][15], if the element R[8][10] is stored at the memory location 45000.



Q.20   Exam - CBSE12A-2016/02A/2

Write any four important characteristics of Object Oriented Programming? Give example of any one of the characteristics using C++.