Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What keyword in C++ enables polymorphism?

  1. static

  2. virtual

  3. const

  4. extern

The correct answer is: virtual

In C++, the virtual keyword enables polymorphism by allowing a class to provide different implementations of functions within derived classes. The other options do not directly enable polymorphism. Static is used to define static variables or functions, const is used to specify constant variables, and extern is used to declare global variables. Although const and extern can also be used in C++ polymorphism, they are not the enabling keyword. Therefore, option B is the correct answer.