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.


How do C++ comments start and end?

  1. // for single-line and /* */ for multi-line

  2. # for single-line and <!-- --> for multi-line

  3. // for both single and multi-line

  4. -- for single-line and /* */ for multi-line

The correct answer is: // for single-line and /* */ for multi-line

In C++, single-line comments start with // and end at the end of the line. Multi-line comments start with /* and end with */. Option B is incorrect because # is not used for comments in C++, it is used for preprocessor directives. Option C is incorrect because // is used for single-line comments, but multi-line comments require the use of /* and */. Option D is incorrect because -- is not used for comments in C++, it is used for decrementing.