C# Interview Questions and Answers Part 4

11)   What is output?

static void Main(string[] args)

    {

        Console.WriteLine(byte.MinValue);

        Console.WriteLine(byte.MaxValue);

        Console.ReadLine();

     }

OUTPUT :  

           0

           255

 

12)   What is output?

static void Main(string[] args)

    {

        Console.WriteLine(typeof(float));

        Console.WriteLine(sizeof(long));

        Console.ReadLine();

     }

OUTPUT :  

   System.Single

     8

13)   what is the output?

static void Main(string[] args)

    {

        int i = 0;

    restart:

        i++;

        if (i < 10)

        {

            Console.Write(i + " ");

            goto restart;

        }

        Console.ReadLine();      

    }

OUTPUT :  

1 2 3 4 5 6 7 8 9

14)    what is the output?

 static void Main(string[] args)

    {

        int i = 20;

        for (; ; )

        {

            Console.Write(i + " ");

            if (i >= -10)

                i -= 4;

            else

                break;

        }

        Console.ReadLine();      

    }

OUTPUT :  

20 16 12 8 4 0 -4 -8 -12 0

15)   What is the output?.

static void Main(string[] args)

    {

        int i = 0;

        do

         {

         Console.WriteLine(i);

          i+=1;

         }

         while (i <= 10);

        Console.ReadLine();

}

OUTPUT :   

0

1

2

3

4

5

6

7

8

9

10



Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker