Multiple choice technology programming languages

If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?

  1. parentheses ( )

  2. braces { }

  3. brackets [ ]

  4. arrows < >

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

In C/C++/Java, when a for loop contains multiple statements in its body, you must enclose them in curly braces { } to form a block. Without braces, only the first statement would be part of the loop, and the rest would execute once after the loop completes.