C++ MCQs with answers Page - 85

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. A member function can always access the data in __________, (in C++).

  • (A) the private part of its class
  • (B) the public part of its class
  • (C) the object of which it is a member
  • (D) the class of which it is member

A

Admin • 833.24K Points
Coach

Q. Which of the following is not correct for virtual function in C++?

  • (A) Virtual function is defined in base class.
  • (B) Virtual function should be accessed using pointers.
  • (C) Virtual function can be static.
  • (D) Must be declared in public section of class.

A

Admin • 833.24K Points
Coach

Q. Which of the following cannot be passed to a function in C++?

  • (A) Header file
  • (B) Array
  • (C) Structure
  • (D) Constant

A

Admin • 833.24K Points
Coach

Q. Which of the following, in C++, is inherited in a derived class from base class?

  • (A) Virtual methods
  • (B) Data members
  • (C) Destructor
  • (D) Constructor

A

Admin • 833.24K Points
Coach

Q. When a method in a subclass has the same name and type signature as a method in the superclass, then the method in the subclass _____ the method in the superclass.

  • (A) Overrides
  • (B) Inherits
  • (C) Friendships
  • (D) Overloads

A

Admin • 833.24K Points
Coach

Q. It is possible to define a class within a class termed as nested class. There are _____ types of nested classes.

  • (A) 2
  • (B) 3
  • (C) 4
  • (D) 5

A

Admin • 833.24K Points
Coach

Q. When one object reference variable is assigned to another object reference variable then

  • (A) it is illegal to assign one object reference variable to another object reference variable.
  • (B) a copy of the reference is not created.
  • (C) a copy of the reference is created.
  • (D) a copy of the object is created.

A

Admin • 833.24K Points
Coach

Q. Which of the following is not a correct statement?

  • (A) Abstract class does not contain any definition of implementation.
  • (B) Abstract class can be initiated.
  • (C) Abstract class can directly be initiated with ‘new’ operator.
  • (D) Every class containing abstract method must be declared abstract.

A

Admin • 833.24K Points
Coach

Q. Which of the following is true about templates?
1) Template is a feature of C++ that allows us to write one code for different data types.
2) We can write one function that can be used for all data types including user defined types. Like sort(), max(), min(), ..etc.
3) We can write one class or struct that can be used for all data types including user defined types. Like Linked List, Stack, Queue,..etc.
4) Template is an example of compile time polymorphism.

  • (A) 1 and 2
  • (B) 1, 2 and 3
  • (C) 1, 2 and 4
  • (D) 1, 2, 3 and 4

A

Admin • 833.24K Points
Coach

Q. Which of the following is incorrect in C++?
(1)When we write overloaded function we must code the function for each usage.
(2)When we write function template we code the function only once.
(3)It is difficult to debug macros
(4)Templates are more efficient than macros

  • (A) 1 and 2
  • (B) 3 and 4
  • (C) 1, 2 and 3
  • (D) 1, 2, 3 and 4

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