Multiple choice

What will be the output of the above code?

for(;;)
Console.Writeline(Hello);

 

  1. Compilation Error

  2. Hello will be printed only once.

  3. Hello will not be printed even once.

  4. Hello will be printed infinite number of times.

  5. Runtime error

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

Since the for loop has no initialisation and condition, the loop will run infinitely. The message 'Hello' will be printed infinite number of times.