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!

Practice this question and more.


Why does C++ support the virtual keyword, according to the text?

  1. For easier debugging

  2. To make programming easier for beginners

  3. For efficiency tuning

  4. To support legacy C code

The correct answer is: For efficiency tuning

C++ supports the virtual keyword for efficiency tuning. This allows for dynamic binding at runtime, improving performance and flexibility within the code. Option A is incorrect because virtual functions have no direct relation to debugging. Option B is incorrect because virtual functions are not used for making programming easier for beginners. Option D is incorrect because although C++ is an extension of C, it does not primarily support legacy C code.