What is i after the following for loop?

int y = 0;
for (int i = 0; i < 10; ++i) {
y += i;
}
a. 9
b. 10
c. 11
d. undefined

d The scope for i is inside the loop. After the loop, i is not defined. So, the correct answer is D.

Computer Science & Information Technology

You might also like to view...

The .class extension on a file means that the file:

a. Contains java source code b. Contains HTML c. is produced by the Java compiler (javac). d. None of the above.

Computer Science & Information Technology

Setting up an IPv6 tunnel is easy.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology