Simplified guide of MCQs for Exams, Interviews

Topic: Computer Programming

1 .  All members of class have which access to its members

  • A. private
  • B. public
  • C. protected
  • D. depends

Correct Answer:

private


2 .  Which operator is used to define a member of a class from outside the class definition

  • A. ->
  • B. ::
  • C. .
  • D. >>

Correct Answer:

::


3 .  Constructor is

  • A. A class automatically called whenever a new object of this class is created
  • B. A class automatically called whenever a new object of this class is destroyed
  • C. A function automatically called whenever a new object of this class is created
  • D. A function automatically called whenever a new object of this class is destroyed

Correct Answer:

A function automatically called whenever a new object of this class is created


4 .  If no constructor is there, then compiler assumes the class to have a default constructor with no arguments

  • A. True
  • B. False

Correct Answer:

True


5 .  Can we overload constructors in C++

  • A. Yes
  • B. No

Correct Answer:

Yes


6 .  Every class has atleast one construtor

  • A. True
  • B. False

Correct Answer:

True


7 .  Declaring pointer more than one can cause

  • A. Trap
  • B. error
  • C. abort a program
  • D. none of above

Correct Answer:

Trap


8 .  Which is not a correct variable type

  • A. float
  • B. real
  • C. double
  • D. int

Correct Answer:

real


9 .  Which is boolean operator for logical and

  • A. &&
  • B. ||
  • C. &|

Correct Answer:

&&


10 .  Difference between static and dynamic memory allocation is

  • A. In static memory allocation memory to be allocated in preknown
  • B. In dynamic memory allocation memory to be allocated in preknown
  • C. There is no differnece

Correct Answer:

In static memory allocation memory to be allocated in preknown