C++ MCQs with answers Page - 60

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. Which of the following keyword supports dynamic method resolution?

  • (A) Typeid
  • (B) Dynamic
  • (C) Virtual
  • (D) abstract

A

Admin • 833.24K Points
Coach

Q. Which of the following is the most preferred way of throwing and handling exceptions?

  • (A) Throw the pointer value and provide catch for the pointer type.
  • (B) Throw by value and catch by value
  • (C) Throw by reference and catch by reference.
  • (D) Throw by value and catch by reference.

A

Admin • 833.24K Points
Coach

Q. Which of the following is not true about preprocessor directives

  • (A) They have to end with a semi colon
  • (B) They begin with a hash symbol
  • (C) They are processed by a preprocessor
  • (D) They form an integral part of the code

A

Admin • 833.24K Points
Coach

Q. What’s wrong? while( (i < 10) && (i > 24))

  • (A) the test condition is always true
  • (B) the test condition is always false
  • (C) the while loop is an exit-condition loop
  • (D) the logical operator && cannot be used in a test condition

A

Admin • 833.24K Points
Coach

Q. A continue statement causes execution to skip to

  • (A) the next iteration of the loop
  • (B) the statement following the continue statement
  • (C) the first statement after the loop
  • (D) the return 0; statement

A

Admin • 833.24K Points
Coach

Q. What’s wrong?

Code:
(x = 4 && y = 5) ? (a = 5) ; (b = 6);
  • (A) the question mark should be an equal sign
  • (B) there are too many variables in the statement
  • (C) the conditional operator is only used with apstrings
  • (D) the first semicolon should be a colon

A

Admin • 833.24K Points
Coach

Q. What’s wrong?

Code:
for (int k = 2, k <=12, k++)
  • (A) the variable must always be the letter i when using a for loop
  • (B) there should be a semicolon at the end of the statement
  • (C) the commas should be semicolons
  • (D) the increment should always be ++k

A

Admin • 833.24K Points
Coach

Q. Which of the following is not recommended in a header file?

  • (A) Function definitions
  • (B) Template definitions
  • (C) Class definitions
  • (D) Type definitions (typedefs)

A

Admin • 833.24K Points
Coach

Q. Which of the STL containers store the elements contiguously (in adjacent memory locations)?

  • (A) std::list
  • (B) std::set
  • (C) std::vector
  • (D) std::map

A

Admin • 833.24K Points
Coach

Q. Which of the following is not a standard exception built in C++.

  • (A) std::bad_creat
  • (B) std::bad_alloc
  • (C) std::bad_cast
  • (D) std::bad_typeid

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