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 can const variables not be used for?

  1. To create constant pointers.

  2. As rvalues in expressions.

  3. To take their address in operations.

  4. To modify once initialized.

The correct answer is: To modify once initialized.

Const variables cannot be used for modification once they have been initialized. This means that options A, B, and C are incorrect because they all involve actions that alter or modify the original const variable. Creating constant pointers, using the variable as an rvalue in expressions, and using the variable's address in operations all involve changing the value of the const variable, which is not possible.