Inheritance and Dynamic Memory Management: MCQ Unit-4 CSE202
Inheritance and Dynamic Memory Management: MCQ Unit-4 CSE202
Que.1. Which of the following cannot be inherited from the base class?
A. Constructor
B. Friend
C. Both a and b cannot be inherited
D. Both a and b can be inherited
Right Answer: C
Right Answer: D
Que.3. Which of the following is a valid destructor of the class name “Country”
A. int ~Country()
B. void Country()
C. int ~Country(Contry obj)
D. void ~Country()
Right Answer: D
Right Answer: B
Que.5. If a class x needs to be derived from a class y, which of the following ways is
Correct to do so?
A. Class x: public y
B. Class y : public x
C. Class x derives public y
D. Class y derives public x
Right Answer: A
Que.6. A class cannot inherit members from more than one class
A. True
B. False
Right Answer: B
Right Answer: D
Right Answer: B
Right Answer: D
Que.10. If a member needs to have uniQue value for all the objects of that same class, declare
the member as
A. Global variable outside class
B. Local variable inside constructor
C. Static variable inside class
D. Dynamic variable inside class
Right Answer: B
Void main()
int a = 20;
count <<a<<::a;
A. Syntax error
B. 10 20
C. 20 10
D. 20 20
Right Answer: C
mychar++;
++myshort;
mylong++;
count<<mychar<<myshort<<mylong;
Right Answer: D
Que.3. Which one of the following is not a fundamental data type in C++
A. float
B. string
C. Int
D. Wchar_t
Right Answer: B
Que.4. What is the output of the following code snippet assuming user enters the side
as 4?
class square
Public:
double side1;
double area() {
double (side1*side1);
};
int main(){
double area1=0;
squre c1,c2;
return (0);
A. 16
C. 8
D. 12
Right Answer: B
Que.5. When class B is inherited from class A, what is the order in which the
Right Answer: A
Que.6. Which one of the following is not a valid reserved keyword in C++
A. Explicit
B. Public
C. Implicit
D. Private
Right Answer: C
Que.7. Value of a in a = (b = 5, b + 5); is
A. Junk value
B. Syntax error
C. 5
D. 10
Right Answer: D
A. True
B. False
Right Answer: B
Que.9. Which of the following members do get inherited but become private members
in child class
A. Public
B. Private
C. Protected
Right Answer: C
Right Answer: D