الثلاثاء، 19 أغسطس 2014

MCQ on c++ Programming with Answers set-6


1. If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access.

A) Protected and public data only in C and B

B) Protected and public data only in C

C) Private data in A and B

D) Protected data in A and B


2. Overloading the function operator

A) requires a class with an overloaded operator

B) requires a class with an overloaded [ ] operator.

C) allows you to create objects that act syntactically like functions.

D) usually make use of a constructor that takes arguments.


3. What is a constructor?

A) A function called when an instance of a class is initialized.

B) A function that is called when an instance of a class is deleted.

C) A special function to change the value of dynamically allocated memory

D) A function that is called in order to change the value of a variable.


4. Mechanism of deriving a class from another derived class is known as .........

A) Polymorphism

B) Single Inheritance

C) Multilevel Inheritance

D) Message Passing


5. RunTime Polymorphism is achieved by ..........

A) friend function

B) virtual function

C) operator overloading

D) function overloading


6. Which of the following is the proper declaration of a pointer?

A) int x;

B) int &x;

C) ptr x;

D) int *x;


7. In multiple inheritance

A) the base classes must have only default constructors

B) cannot have virtual functions

C) can include virtual classes

D) None of the above


8. for (; ;)

A) means the test which is done using some expression is always true

B) is not valid

C) will loop forever

D) should be written as for( )


9. The compilers converts all operands upto to type of the largest operand is called as ............

A) typeconversion

B) expression

C) evaluation

D) precedence


10. The keyword FRIEND does not appear in

A) the class allowing access to another class

B) the class desiring access to another class

C) the private section of a class

D) the public section of a class





Answers:


1. If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access.

D) Protected data in A and B

2. Overloading the function operator

A) requires a class with an overloaded operator

3. What is a constructor?

A) A function called when an instance of a class is initialized.

4. Mechanism of deriving a class from another derived class is known as .........

C) Multilevel Inheritance

5. RunTime Polymorphism is achieved by ..........

B) virtual function

6. Which of the following is the proper declaration of a pointer?

D) int *x;

7. In multiple inheritance

C) can include virtual classes

8. for (; ;)

C) will loop forever

9. The compilers converts all operands upto to type of the largest operand is called as ............

A) typeconversion

10. The keyword FRIEND does not appear in

C) the private section of a class



Related Posts:


ليست هناك تعليقات:

إرسال تعليق