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

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

Prepare for the ultimate C++ challenge with our comprehensive quiz based on 'Thinking in C++'. Test your knowledge with engaging questions and receive instant feedback. Perfect for both beginners and experienced C++ programmers looking to sharpen their skills!

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 programming principle allows the easy addition of new types without changing existing code?

  1. Type safety

  2. Polymorphism

  3. Early binding

  4. Late binding

The correct answer is: Polymorphism

Polymorphism is used to allow objects of different types to be treated in a consistent manner, allowing for the addition of new types without having to modify existing code. Type safety, also known as static typing, is a programming principle that ensures variables are assigned the appropriate type before they are used. Early binding and late binding are both forms of polymorphism, but early binding requires the type of an object to be determined at compile time, while late binding defers the assignment of type until runtime. These principles are not as effective as polymorphism in allowing for the easy addition of new types without modifying existing code.