C++ MCQs with answers Page - 119

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. What happens when delete is used for a NULL pointer?
int *ptr = NULL;
delete ptr;

  • (A) Compiler Error
  • (B) Run-time Crash
  • (C) No Error
  • (D) None

A

Admin • 833.24K Points
Coach

Q. Which of the following is true about virtual functions in C++?

  • (A) Virtual functions are functions that can be overridden in derived class with the same signature.
  • (B) Virtual functions enable run-time polymorphism in a inheritance hierarchy.
  • (C) If a function is ‘virtual’ in the base class, the most-derived class implementation of the function is called according to the actual type of the object referred to, regardless of the declared type of the pointer or reference. In non-virtual f
  • (D) All of the above

A

Admin • 833.24K Points
Coach

Q. Which of the following is true about pure virtual functions?
1) Their implementation is not provided in a class where they are declared.
2) If a class has a pure virtual function, then the class becomes abstract class and an
instance of this class cannot be created.

  • (A) Both 1 and 2
  • (B) Only 1
  • (C) Only 2
  • (D) Neither 1 nor 2

A

Admin • 833.24K Points
Coach

Q. Which of the two features match each other?

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

A

Admin • 833.24K Points
Coach

Q. What is default access specifier for data members or member functions declared within a class without any specifier, in C++?

  • (A) Private
  • (B) Protected
  • (C) Public
  • (D) Depends on Compiler

A

Admin • 833.24K Points
Coach

Q. If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used here?

  • (A) Encapsulation
  • (B) Inheritance
  • (C) Polymorphism
  • (D) Abstraction

A

Admin • 833.24K Points
Coach

Q. Which feature in OOP is used to allocate additional function to a predefined operator in any language?

  • (A) Operator Overloading
  • (B) Function Overloading
  • (C) Operator Overriding
  • (D) Function Overriding

A

Admin • 833.24K Points
Coach

Q. Which among the following best defines abstraction?

  • (A) Hiding the implementation
  • (B) Showing the important data
  • (C) Hiding the important data
  • (D) Hiding the implementation and

A

Admin • 833.24K Points
Coach

Q. A base class is also known as class.

  • (A) Basic
  • (B) Inherited
  • (C) Super
  • (D) Sub

A

Admin • 833.24K Points
Coach

Q. If class A is derived from another derived class B which is derived from class C, which class will have maximum level of abstraction?

  • (A) Class A
  • (B) Class B
  • (C) Class C
  • (D) All have the same level of abstraction

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