Multiple choice technology programming languages

Consider the following case; int i; int k; for(i=0;k<10;i++){/* The body */} This will not compile?

  1. True

  2. False

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

The code compiles successfully because k is initialized to 0 by default. The loop condition k<10 is true initially, so the loop body runs. After that, k remains 0 while i increments, so this becomes an infinite loop (until integer overflow). The issue is a logical error, not a compilation error.