Topic / 30 questions

C++ MCQs

C++ MCQs test your understanding of the C++ language, including classes, constructors, pointers, inheritance and exception handling. They help computer science students and software job applicants check their basics, and every question shows its correct answer immediately so you can fix gaps before an exam or interview.

Advertisement
Question 09 C++

How is a pure virtual function declared in C++?

Correct answer B. By writing = 0 at the end of its declaration

Open question
Advertisement
Advertisement

About C++ MCQs

This topic covers object-oriented C++ concepts that written tests often check. Questions ask which keywords generate and handle exceptions, namely try, throw and catch, and how code reusability is achieved through inheritance. You will see that a default constructor takes no arguments, that class members are private by default unlike struct members, and that an uninitialised pointer is called a wild pointer. Other items deal with declaring a pointer more than once and basic syntax rules. These points come up in computer science lecturer tests, software house screening tests and placement rounds.

Exams that include C++ MCQs

Pakistan

  • NTS
  • PPSC
  • FPSC
  • Lecturer tests

India

  • Campus placements
  • UGC NET
  • SSC CGL

Bangladesh

  • Government job tests
  • Bank job exams
  • BCS

Frequently asked questions

What is the default access specifier for class members in C++?

Members of a class in C++ are private by default, so they cannot be accessed from outside the class unless declared public or protected. In a struct, members are public by default. This difference is one of the most common C++ MCQ topics.

What is a wild pointer in C++?

A wild pointer is a pointer that has been declared but not initialised, so it holds an unpredictable address. Using it can crash a program or corrupt memory. Good practice is to initialise pointers to nullptr or to a valid address when they are declared.

Last reviewed October 2026