Question 1: What will be the output of the following program?
int i = 0;
for(;;)
{
if (i < 5)
Console.Write(i);
else
break;
i++;
}
Question 2: What will be the output of the following program?
for (double d = 1.01D; d < 1.05; d+= 0.01D)
{
Console.Write("{0}, ", d);
}
Question 3: What will be the output of the following program?
public static void Main()
{
while (ProcessMessage());
}
static bool ProcessMessage() {
Console.Write("Hello");
return false;
}
Question 4: What will be the output of the following program?
int i = 15;
for( ; ; )
{
Console.Write("{0} ",i);
if (i >= -5)
i -= 5;
else
break;
}
Question 5: What will be the output of the following program?:
public static void Main(string[] args)
{
string str = "Hello";
for(int i = 0; i<str.Length; i++)
Console.WriteLine(str[i]);
}