Multiple choice

Which of the following statements in C++ creates an infinite loop?

  1. while(; ;)

  2. for(; ;)

  3. if(; ;)

  4. switch(; ;)

  5. do(; ;)

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

This is the correct option as for loop consist of three parts i.e, initialization ; condition; increment and if none of the part is not specified by the user then infinite loop is created.