41.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = 2, j = 4;
    switch (i + j * 2)
    {
    case 1 :
    case 2 :
        Console.WriteLine("1 and 2");
        break;
    case 3 to 10:
        Console.WriteLine("3 to 10");
        break;
    }
    Console.ReadLine();
}

42.
For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop?
static void Main(string[] args)
{
    int i = 1234 ,j = 0;
     /*ADD CODE HERE */
    Console.WriteLine(j);
}

do
   {
       j = j + (i % 10);
   }while ((i = i / 10)!= 0);

do
    {
        j = j + (i % 10);
    }while ((i / 10)!= 0);

do
    {
        j = j + (i % 10);
    }while ((i % 10)!= 0);

do
    {
        j = j + (i % 10);
    }while ((i/10 == 0)!= 0);

43.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int x = 0;  
    while (x < 20)
    {
        while (x < 10)
        {
            if (x % 2 == 0)
            {
                Console.WriteLine(x);
            }
            x++;
        }
    }
    Console.ReadLine();
}

44.
What will be the output of the following C# code?
static void Main(string[] args)
{
    float i = 1.0f, j = 0.05f;
    do
    {
        Console.WriteLine(i++ - ++j);
    }while (i < 2.0f && j <= 2.0f);
    Console.ReadLine();
}

45.
What will be the output of the following C# code?
static void Main(string[] args)
{
    Console.WriteLine("HI");
    continue;
    Console.WriteLine("Hello");
    Console.ReadLine();
}

46.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = 0, j = 0;
    l1: while (i < 2)
    {  
        i++;
        while (j < 3)
        {
            Console.WriteLine("loop\n");
            goto l1;
        }
     }
    Console.ReadLine();
}

47.
What will be the output of the following C# code?
{
    int i;
    Console.WriteLine("Hi");
    for (i = 1; i <= 10; i++)
        Program.Main(args);
    Console.ReadLine();
}

48.
Which statement is correct among the mentioned statements?
i. The for loop works faster than a while loop
ii. for( ; ; )implements an infinite loop

50.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = -10;
    for ( ;Convert.ToBoolean(Convert.ToInt32(i)) ;Console.WriteLine(i++)) ;
    Console.ReadLine();
}