C++ MCQs with answers Page - 95

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. From which STL we can insert/remove data from anywhere?

  • (A) List
  • (B) Stack
  • (C) Deque
  • (D) Vector

A

Admin • 833.24K Points
Coach

Q. Which data structure is used by Map?

  • (A) Balance Binary Tree
  • (B) AVL Tree
  • (C) Binary Tree
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. If a class(has one virtual function) has 5 Objects then how many Vtable it will have?

  • (A) 0
  • (B) 1
  • (C) 5
  • (D) Depends on Compiler

A

Admin • 833.24K Points
Coach

Q. There is nothing like a virtual constructor of a class.

  • (A) True
  • (B) False
  • (C) ---
  • (D) ---

A

Admin • 833.24K Points
Coach

Q. C++ provides facility to specify that the compiler should match function calls with the correct definition at the run time. This process is called as

  • (A) Static binding
  • (B) Dynamic Binding
  • (C) NA
  • (D) NA

A

Admin • 833.24K Points
Coach

Q. The output of this program is

Code:
int
main () { 
cout << “Hello World!” return 0; 
}
  • (A) Hello World
  • (B) Syntax error
  • (C) 0
  • (D) Hello World!

A

Admin • 833.24K Points
Coach

Q. The return value of the following code is

Code:
Class1& test(Class1 obj)
{
Class1 *ptr = new Class1();
………
return ptr;
}
  • (A) object of Class1
  • (B) reference to ptr
  • (C) reference of Class1
  • (D) object pointed by ptr

A

Admin • 833.24K Points
Coach

Q. The output of

Code:
{
int a = 5;
int b = 10;
cout << (a>b?a:b);
}
  • (A) 5
  • (B) 10
  • (C) Syntax error
  • (D) None of above

A

Admin • 833.24K Points
Coach

Q. The output of this program is

Code:
int a = 10;
void main()
{
int a = 20;
cout << a << ::a;
}
  • (A) Syntax error
  • (B) 10 20
  • (C) 20 10
  • (D) 20 20

A

Admin • 833.24K Points
Coach

Q. In the below example of constructor overloading, the following statement will call which constructor
Example obj = new Example (1,2,3);

Code:
class Example{
public: int a,b,c;
Example(){a=b=c=1;} //Constructor 1
Example(int a){a = a; b = c = 1;} //Constructor 2
Example(int a,int b){a = a; b = b; c = 1;} //Constructor 3
Example(int a,int b,int c){ a = a; b = b; c = c;} //Constructor 4
}
  • (A) Constructor 2
  • (B) Constructor 4
  • (C) Constrcutor 1
  • (D) Type mismatch error

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