Learn C++ MCQs

Prepare C++ MCQs (Multiple choice Questions) for exam and job interviews.

What is the correct way to declare a multi-dimensional array?

1) int arr[5][5];

2) int arr[5];

3) Both 1 and 2

4) None of the above

Answer : Option 1

Which operator is used to access members of a class?

1) .

2) ->

3) ::

4) All of the above

Answer : Option 4

What is the output of cout << (5 && 0) << endl;

1) 1

2) 0

3) true

4) false

Answer : Option 2

Which of the following is a method for exception handling in C++?

1) try

2) catch

3) throw

4) All of the above

Answer : Option 4

What will be the output of cout << (1 + 2 * 3) << endl;

1) 7

2) 9

3) 6

4) None of the above

Answer : Option 1

What is the correct way to define a friend class in C++?

1) friend class MyClass;

2) class MyClass; friend;

3) None of the above

4) friend class;

Answer : Option 1

What is the output of cout << (true && true || false) << endl;

1) 1

2) 0

3) true

4) false

Answer : Option 1

Which of the following is a feature of C++?

1) Encapsulation

2) Inheritance

3) Polymorphism

4) All of the above

Answer : Option 4

What will be the output of cout << (5 * 2 + 10) << endl;

1) 20

2) 10

3) 15

4) None of the above

Answer : Option 1

Which of the following is not a part of the C++ standard library?

1) vector

2) iostream

3) string

4) console

Answer : Option 4