Learn C++ MCQs

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

What is the output of cout << (3 + 5 * 2) << endl;

1) 13

2) 16

3) 8

4) 10

Answer : Option 1

Which of the following is a standard exception class in C++?

1) std::exception

2) std::runtime_error

3) std::logic_error

4) All of the above

Answer : Option 4

What will be the output of cout << (true && true) << endl;

1) 1

2) 0

3) true

4) false

Answer : Option 1

Which keyword is used to define a constant in C++?

1) const

2) static

3) final

4) None of the above

Answer : Option 1

Which of the following is the correct way to include a header file in C++?

1) #include

2) #include "iostream"

3) Both 1 and 2

4) None of the above

Answer : Option 3

What is the output of cout << (10 == 10) << endl;

1) 1

2) 0

3) true

4) false

Answer : Option 1

Which of the following data structures is not part of the STL?

1) vector

2) map

3) deque

4) list

Answer : Option 5

What is the correct way to define an enum in C++?

1) enum Color { Red, Green, Blue };

2) enum { Red, Green, Blue } Color;

3) enum Color { Red, Green, Blue };

4) None of the above

Answer : Option 1

Which of the following operators cannot be overloaded in C++?

1) <<

2) ++

3) =

4) ::

Answer : Option 4

What will be the output of cout << (8 % 5) << endl;

1) 3

2) 2

3) 1

4) None of the above

Answer : Option 1