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.


For operators that do not modify their operands, how should the operands be passed?

  1. By value

  2. By reference

  3. By constant reference

  4. As a pointer

The correct answer is: By constant reference

When passing operands to operators, it is important to consider whether or not the operands will be modified by the operator. In cases where the operands should not be modified, it is best to pass them by constant reference. This ensures that the original values of the operands will not be altered, as they would be if passed by value or by reference. Passing operands as a pointer would also give the operator access to the original values, which could result in unintended modifications.