Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Select the output for the following set of code :
static void Main(string[] args)
{
int a = 0;
int i = 0;
int b;
for (i = 0; i < 5; i++)
{
a++;
Console.WriteLine(“Hello \n”);
continue;
}
Console.ReadLine();
}

Select the output for the following set of code :
static void Main(string[] args)
{
int a = 0;
int i = 0;
int b;
for (i = 0; i < 5; i++)
{
a++;
Console.WriteLine(“Hello \n”);
continue;
}
Console.ReadLine();
}
a) print hello 4 times
b) print hello 3 times
c) print hello 5 times
d) print hello infinite times

Answer: c
Explanation: Condition executes until and unless i < 5. So, it prints “hello” until ‘i’ condition is satisfied.
Output : Hello
Hello
Hello
Hello
Hello

Join The Discussion