Q 6. 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 7. 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 8. 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 9. 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
Q 10. What does the 'sizeof' operator do in C++?
A. Returns the size of the variable in bytes
B. Returns the size of the pointer
C. Returns the number of elements in an array
D. Allocates memory space for a variable