C++ MCQs with answers Page - 58

Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. If a base class destructor is not virtual, then

  • (A) Destructor in derived class can not be called when accessed through a pointer to the base class.
  • (B) It can not be called when accessed from pointer.
  • (C) It can not be called.
  • (D) It can not have a function body.

A

Admin • 833.24K Points
Coach

Q. Maximum number of template arguments in a function template is

  • (A) one
  • (B) two
  • (C) three
  • (D) many

A

Admin • 833.24K Points
Coach

Q. In access control in a protected derivation, visibility modes will change as follows:

  • (A) only private becomes protected.
  • (B) public and protected become protected.
  • (C) only public becomes protected.
  • (D) private, public and protected become protected

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is valid?

  • (A) We can not change operator templates.
  • (B) We can change the associativity of the C++ operators.
  • (C) We can change the precedence of the C++ operators.
  • (D) We can create new C++ operators.

A

Admin • 833.24K Points
Coach

Q. What will be the output of the following program?

Code:
#include iostream.h void main() { float x=5,y=2; int result; result=x % y; cout result; }

  • (A) 1
  • (B) 1.5
  • (C) 2.5
  • (D) Error message

A

Admin • 833.24K Points
Coach

Q. Which can be passed as an argument to a function?

  • (A) another function
  • (B) constant
  • (C) expression
  • (D) all of the above.

A

Admin • 833.24K Points
Coach

Q. Member functions, when defined within the class specification:

  • (A) are not inline by default.
  • (B) are inline by default, unless they are too big or too complicated.
  • (C) are not inline.
  • (D) are always inline.

A

Admin • 833.24K Points
Coach

Q. An expression A.B in C++ means ____

  • (A) Product of A and B
  • (B) A is member of object B
  • (C) B is member of Object A
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. A C++ code line ends with ___

  • (A) A Semicolon (;)
  • (B) A Comma (,)
  • (C) A Slash (/)
  • (D) A Fullstop(.)

A

Admin • 833.24K Points
Coach

Q. Reusability of code in C++ is achieved through ____

  • (A) Encapsulation
  • (B) Polymorphism
  • (C) Inheritance
  • (D) Both B and C

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ