Q 6. In C++, which of the following is used to implement polymorphism?
A. Inheritance
B. Encapsulation
C. Abstraction
D. Function Overloading
Q 7. Which of the following is the correct definition of a class in C++?
A. class MyClass {}
B. class MyClass() {}
C. class MyClass; {}
D. class MyClass { }
Q 8. Which of the following is true about constructors in C++?
A. Constructor can have a return type.
B. Constructor is called only once.
C. Constructor cannot be inherited.
D. Constructor must have parameters.
Q 9. What is the default access specifier for members of a class in C++?
A. public
B. private
C. protected
D. none of the above
Q 10. Which of the following will be the output of the following C++ code? int a = 7, b = 3; cout << a % b;
A. 3
C. 7
D. Error