Chapter 14: Classes and objects - Online Test

Q1. The variables declared inside the class are known as data members and the functions are known as
Answer : Option C
Explaination / Solution:
No Explaination.


Q2.

Which of the following statements about member functions are True or False?

i) A member function can call another member function directly with using the dot operator.

ii) Member function can access the private data of the class.
Answer : Option B
Explaination / Solution:
No Explaination.


Q3. A member function can call another member function directly, without using the dot operator called as
Answer : Option C
Explaination / Solution:
No Explaination.


Q4. The member function defined within the class behave like
Answer : Option A
Explaination / Solution:
No Explaination.


Q5. Which of the following access specifier protects data from inadvertent modifications?
Answer : Option A
Explaination / Solution:
No Explaination.


Q6.

 class x

{

int y;

 public:

 x(int z){y=z;}

 } x1[4];

int main()

{ x x2(10); return 0;}

How many objects are created for the above program

Answer : Option B
Explaination / Solution:
No Explaination.


Q7.

State whether the following statements about the constructor are True or False.

i) constructors should be declared in the private section.

ii) constructors are invoked automatically when the objects are created.

Answer : Option C
Explaination / Solution:
No Explaination.


Q8.

Which of the following constructor is executed for the following prototype ?

add display( add &); // add is a class name 248
Answer : Option C
Explaination / Solution:
No Explaination.


Q9. What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
Answer : Option A
Explaination / Solution:
No Explaination.


Q10. Which of the following create a temporary instance?
Answer : Option B
Explaination / Solution:
No Explaination.