1)

Select the correct output for the following programming code

class Program
{
public static void Main(string[] args)
{
int i = 2;
for (a = 0; a < 2; a++)
{
int i = 2;
Console. WriteLine(a * i);
}
Console. ReadLine();
}
}


A) 0, 2

B) 0, 2, 4

C) 4, 2, 0

D) Compile time error

Answer:

Option D

Explanation:

The variable 'i' is defined out side the loop and also inside the for loop. So, this gives the compile time error.