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 does a value of type 'bool' print as by default?

  1. 'true' or 'false'

  2. 1 for true, 0 for false

  3. The specific integer values assigned

  4. The address of the variable

The correct answer is: 1 for true, 0 for false

A value of type 'bool' can either be true or false. While 'true' can sometimes be represented as 1 in certain programming languages, it is not the default. Additionally, the value is not an integer type so the option C is incorrect. An address is not a value so option D is also incorrect. By default, a value of type 'bool' prints as either 'true' or 'false'. This means that the answer B is the most appropriate option. While it is true that 'true' can sometimes be represented as 1 in certain programming languages, it is not the default. Additionally, the value is not an integer type so the option C is incorrect. An address is not a value so option D is also incorrect.