31.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int x;
    for (x = 10; x <= 15; x++)
    while (Convert.ToBoolean(Convert.ToInt32(x)))
    {
        do
        {
            Console.WriteLine(1);
            if (Convert.ToBoolean(x >> 1))
            continue;
        }while (Convert.ToBoolean(0));
        break;
    }
    Console.ReadLine();
}

32.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int x;
    for (x = 1; x <= 3; x++)
    {
        int j = 1;
        do
        {
            j++;
        }while (x % j == 2);
        Console.WriteLine(x + " " + j);
    }
    Console.ReadLine();
}

33.
Which of the following conditions are true in the following C# code?
static void Main(string[] args)
{
    Console.WriteLine("Enter a letter:");
    char c = (char)Console.Read();
    if (Char.IsDigit(c) == true)
        Console.WriteLine("A number");
    else if (char.IsLower(c) == true)
        Console.WriteLine("A lowercase letter");
    else if (char.IsUpper(c) == true)
        Console.WriteLine("An uppercase letter");
    Console.ReadLine();
}
a. Enter a letter :
   a
   An uppercase letter
b. Enter a letter :
   A
   An uppercase letter
c. Enter a letter :
   2
   A number
d. Enter a letter :
   2
   A lowercase letter.

34.
What will be the output of the following C# code?
static void Main(string[] args)
{
    char ch = 'p';
    switch (ch)
    {
    case 'p':
        Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch));
        break;
    default:
        Console.WriteLine("default");
        break; 
   }
   Console.WriteLine("main");
}

35.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i;
    int b = 8, a = 32;
    for (i = 0; i <= 10; i++)
    {
        if ((a / b * 2)== 2)
        {
            Console.WriteLine( i + " ");
            continue;
        }
        else if (i != 4)
            Console.Write(i + " ");
        else
            break;
   }
   Console.ReadLine();
}

36.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i;
    int j = 1;
    int []ar = {21, 22, 13, 4};
    switch (ar[j])
    {
    case 1:
        i++;
        break;
    case 2:
        i += 2;
        j = 3;
        continue;
    case 3: 
       i %= 2;
       j = 4;
       continue;
    default: 
       --i;
    }
    Console.WriteLine(i);
    Console.ReadLine();
}

37.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i;
    for (i =-3; i <= 3; i++)
    {
        switch (i)
        {
        case 0:
            Console.WriteLine("zero");
            break;
        }
        if (i > 0)
            Console.WriteLine("A");
        else if (i < 0)
            Console.WriteLine("B");
    }
    Console.ReadLine();
}

38.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = 0;
    int j = 0;
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 3; j++)
        {
            if (i > 1)
                continue;
            Console.WriteLine("Hi \n");
        }
    }
    Console.ReadLine();
}

39.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int temp = 1;
    switch (temp << 2 + temp)
    {
    default: 
        Console.WriteLine("Example1");
        break;
    case 4: 
        Console.WriteLine("Example2");
        break;
    case 5: 
        Console.WriteLine("Example3");
        break;
    case 8: 
        Console.WriteLine("Example4");
        break;
    }
    Console.ReadLine();
}

40.
What will be the output of the following C# code?
static void Main(string[] args)
{
    int  i = 9 , j = 7;
    switch (i - j + 3)
    {
    case 9: 7:
        j += 6;
        break;
    case 5:
        i -= 4;
        break;
    }
    Console.WriteLine(i + "\n" + j);
    Console.ReadLine();
}