Sail E0 Webinar

MCQs

Total Questions : 39 | Page 4 of 4 pages
Question 31.

When are the Global objects destroyed?


  1.    When the control comes out of the block in which they are being used.
  2.    When the program terminates.
  3.    When the control comes out of the function in which they are being used.
  4.    As soon as local objects die.
 Discuss Question
Answer: Option B. -> When the program terminates.


Question 32.

Which of the following statement is incorrect?


  1.    Constructor is a member function of the class.
  2.    The compiler always provides a zero argument constructor.
  3.    It is necessary that a constructor in a class should always be public.
  4.    Both B and C.
 Discuss Question
Answer: Option D. -> Both B and C.


Question 33.

For automatic objects, constructors and destructors are called each time the objects


  1.    enter and leave scope
  2.    inherit parent class
  3.    are constructed
  4.    are destroyed
 Discuss Question
Answer: Option A. -> enter and leave scope


Question 34.

Which constructor function is designed to copy objects of the same class type?


  1.    Create constructor
  2.    Object constructor
  3.    Dynamic constructor
  4.    Copy constructor
 Discuss Question
Answer: Option D. -> Copy constructor


Question 35.

Which of the following statement is correct?


  1.    Constructor has the same name as that of the class.
  2.    Destructor has the same name as that of the class with a tilde symbol at the beginning.
  3.    Both A and B.
  4.    Destructor has the same name as the first member function of the class.
 Discuss Question
Answer: Option C. -> Both A and B.


Question 36.

Destructor has the same name as the constructor and it is preceded by ______ .


  1.    !
  2.    ?
  3.    ~
  4.    $
 Discuss Question
Answer: Option C. -> ~


Question 37.

Can a class have virtual destructor?


  1.    Yes
  2.    No
 Discuss Question
Answer: Option A. -> Yes


Question 38.

A constructor that accepts __________ parameters is called the default constructor.


  1.    one
  2.    two
  3.    no
  4.    three
 Discuss Question
Answer: Option C. -> no


Question 39.

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?


  1.    Compile-time error.
  2.    Preprocessing error.
  3.    Runtime error.
  4.    Runtime exception.
 Discuss Question
Answer: Option A. -> Compile-time error.


Latest Videos

Latest Test Papers