Multiple Choice Questions In C - Test 4

25 March 20120 comments

1)  What will be the Output ?
         main( )
        {
               int a=300,b,c;
               if(a>=400)
                   b = 300;
                   c = 200;
                       printf("%d%d\n",b,c);
        }

  1. 300    200
  2. 200    300
  3. Garbage  200
  4. Prints nothing
 2)  What will be the output ?
           main( )
           {
                 int a = 500 , b , c;
                 if(a>=400)
                      b = 300;
                      c = 200;
                 printf("%d%d",b,c);
            }

  1. 200   300
  2. 300   200
  3. 500   400
  4. None of the above
3 )  What will be the output ?
             main( )
            {
                  int x = 10,y=20;
                  if(x = = y)
                        printf("%d%d",x,y);
             }

  1. 10   20
  2. garbage value
  3. 20   10
  4. prints nothing
4 ) What will be the output ?
              main( )
              {
                    int x =3,y=5;
                    if(x==3)
                          printf("%d",x);
                    else
                          printf("%d",y);
               }

  1. 3
  2. 5
  3. Garbage
  4. None of the above
5 ) What will be the output ?
              main( )
             {
                    int x=3;
                    float y=3.0;
                   if(x = = y)
                           printf(" x and y are equal ");
                  else
                           printf(" x and y are not equal");
              }

  1. x and y are equal
  2. x and y are not equal
  3. Prints nothing
  4. Error
6 ) What will be the output ?
              main( )
             {
                   int x=3, y, z;
                   y = x = 10;
                   z = x<10;
                   printf("%d%d%d",x,y,z);
              }

  1. 10  10  0
  2. 3   3  0
  3. 10  10  1
  4. Error
7) What will be the output ?
            main( )
           {
                 int k=35;
                printf("%d%d%d", k==35,k=50,k>40);
                getch();
           }

  1. 1  50   1
  2. 0  50   0
  3. garbage values
  4. Print nothing
8)  What will be the output ?
           main( )
           {
                int i=65;
                char j='A';
                if(i==j)
                   printf(" C is Interesting ");
                else
                   printf(" C is boring");
            }
  1. C is boring
  2. C is interesting
  3. Error
  4. Unpredictable result
9)  What will be the output ?
             main( )
            {
                int a = 5,b,c;
                b = a = 15;
                c = a<15;
                printf("%d%d%d",a,b,c);
             }

  1. 5  5  5
  2. 15  15  15
  3. 15  15  0
  4. 15  15  1

10) What will be the output ?
             main( )
             {
                   int x = 15;
                   printf("%d%d%d",x!=15,x=20,x<30);
             }

  1. 1  20  1
  2. 0  20  0
  3. 0  0   0
  4. 1  1  1
Answers :

         
1)   Garbage 200 6)   10 10 0
2)   300 200 7)   0 50 0
3)   Prints nothing 8)   C is interesting
4)   3 9)   15 15 0
5)   x and y are equal 10)   1 20 1
Tags : Multiple choice questions in C , objective type questions in C with answers , quiz questions in C
Share this article :

Post a Comment

 
Copyright © 2011. All Compiler - All Rights Reserved