Multiple choice

Choose the correct way to indicate that a line in a C++ program is a comment line, that is, a line the will not be executed as an instruction

  1. begin the line with a # sign

  2. begin the line with double slashes (/ /)

  3. begin and end the line with double hyphens (-_-)

  4. indent the line

  5. none of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In modern C++ (and C99+), single-line comments begin with double slashes (//). This syntax tells the compiler to ignore everything from // to the end of that line. Option B shows this correctly (with a space, but the description is accurate).