1.What will be output of the following program?
#include<stdio.h> 
int main()
{
   float a;
   (int)a= 45;
   printf("%d,a);
   return 0;
}
(A) 45            (B) 45.0            (C) Compilation error                      (D) 0

2.What will be output of the following program?
#include<stdio.h> 
int main()
{
   int a;
   a=sizeof(!5.6);
   printf("%d",a);
   return 0;
}
(A) 4                (B) 8               (C) 2                   (D) Compilation error 

3.What will be output of the following program?
#include<stdio.h>         
int main()
{
   int a=2;
   a=a++ + ~++a;
   printf("%d",a);
   return 0;
}
(A) 1    (B) 2         (C) -1             (D) 0 

4.What will be output of the following program?
#include<stdio.h> 
int main()
{
       int x=100,y=20,z=5;
   printf("%d %d %d");
   return 0;
}
(A) 100 20 5       (B) gr gr gr            (C) 5 20 100       (D) None of the above 

5.What will be output of the following program?
#include<stdio.h> 
int main()
{
       printf("%d %d %d",sizeof(3.14),sizeof(3.14f),sizeof(3.14L));
   return 0;
}
(A) 4 8 10      (B) 8 10 4         (C) 8 4 10        (D) 4 4 8 

6.What will be output of the following program?
#include<stdio.h> 
int main()
{
   int a;
   a=015 + 0x71 +5;
   printf("%d",a);
   return 0;
}
(A) 100          (B) 75            (C) 131               (D)  311

7.What will be output of the following program?
#include<stdio.h> 
void main()
{
   int x;
   x=10,20,30;
   printf("%d",x);
   return 0;
}
(A) 20     (B) 30 (C) 10 (D) Compilation Error 

8.What will be output of the following program?
#include<stdio.h> 
int main()
{
   int a=2,b=7,c=10;
   c=a==b;
   printf("%d",c);
   return 0;
}
(A) 1      (B) 5          (C) 7                 (D) 0 

9.What will be output of the following program?
#include<stdio.h> 
int main()
{
  int i=1;
   i=2+2*i++;
   printf("%d",i);
   return 0;
}
(A) 4             (B) 3              (C) 5                   (D) 6 

10.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int a=5,b=10,c=1;
   if(a&&b>c)
   {
          printf("Balu C Programming");
       }
   else
   {
        break;
   }
}
A) Balu C Programming B) It will print nothing
C) Run time error D) Compilation Error  

11.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int x=-1,y=-1;
   if(++x=++y)
        printf("R.T. Ponting");
   else
        printf("C.H. Gayle");
}
A)R. T Pointing B) C.H. Gayle
C)Warning: Condition is always true D) Compilation Error 

12.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   if(sizeof(void))
        printf("M. Muralilidaran");
   else
        printf("Harbhajan Singh");
}
A) M. Muralilidaran      B)Harbhajan Singh
C)Warning: Condition is always false  D) Compilation error
 
13.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   if(!printf("Mukesh Ambani"))
   if(printf(" Lakashmi Mittal"))
}
A) Mukesh Ambani  B) Lakashmi Mittal 
C) It will print nothing  D) Mukesh Ambani Lakashmi Mittal 

14.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   if(0xA)
        if(052)
            if('\xeb')
                if('\012')
                     printf("Tom hanks");
                else;
            else;
        else;
   else;
}
A) Tom hanks    B)Compilation error: Misplaced else
C) Compilation error: If without any body   
        D) Compilation error: Undefined symbol

15.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int a=10;
   if(printf("%d",a>=10)-10)
            for(;;)
              break;
   else;
}
A) It will print nothing   B) 0     C) 1    D) Compilation error: Misplaced else

16.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int a=5,b=10;
   if(++a||++b)
        printf("%d  %d",a,b);
   else
        printf("John Terry");
}
A) 5 10         B) 6 11                  C) 6 10           D) 5 11

17.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int x=1;
   if(x--)
          printf("The Godfather");
   --x;
   else
          printf("%d",x);
}
A) The Godfather        B) 1         C) 0         D) Compilation error

18.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   if('\0');
   else if(NULL)
              printf("Balu C Programming");
       else;
}
A) Balu C Programming   B) It will print nothing
C) Warning: Condition is always true   D) Warning: Unreachable code 

19. What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int a=5,b=10;
   clrscr();
   if(a<++a||b<++b)
        printf("%d  %d",a,b);
   else
        printf("John Terry");
}
A) 5 10   B) 6 11  C) Compilation error  D) John Terry  

20.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int x=1,y=2;
   if(--x && --y)
        printf("x=%d  y=%d",x,y);
   else
        printf("%d %d",x,y);
}
(A) 1 2          (B) x = 1, y = 2                 (C)0 2            (D) x = 0, y = 1 

21.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int a=2;
   if(a--,--a,a)
        printf("The Dalai Lama");
   else
        printf("Jim Rogers");
}
(A) The Dalai Lama         (B) Jim Rogers
(C) Run time error      
        (D) Compilation error: Multiple parameters in if statement

22.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
    int check=2;
    switch(check)
    {
       case 1: printf("D.W.Steyn");
       case 2: printf(" M.G.Johnson");
       case 3: printf(" Mohammad Asif");
       default: printf(" M.Muralidaran");
    } 
}
(A) M.G.Johnson                                                                    (B)M.Muralidaran
        (C)M.G.Johnson Mohammad Asif M.Muralidaran  (D) Compilation error  

23.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
    int movie=1;
switch(movie<<2+movie)
{
          default:printf("3 Idiots");
          case 4: printf(" Ghajini");
          case 5: printf(" Krrish");
          case 8: printf(" Race");
}  
}
(A) 3 Idiots Ghajini Krrish Race        (B) Race
(C) Krrish                                   (D) Ghajini Krrish Race  

24.What will be output when you will execute following c code?
  #include<stdio.h>
void main()
{
    switch(5||2|1)
{
        case 3&2:printf("Anatomy of a Murder");
              break;
       case -~11:printf("Planet of Apes");
              break;
       case 6-3<<2:printf("The conversation");
              break;
case 5>=5:printf("Shaun of the Dead");
      }  
}
A) Anatomy of a Murder   B) Planet of Apes  
C) The conversation   D) Shaun of the Dead  

25.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   switch(6)
   {
       case 6.0f:printf("Sangakkara");
              break;
       case 6.0: printf("Sehwag");
              break;
       case 6.0L:printf("Steyn");
              break;
       default:  printf("Smith");
   }  
}
A) Sangakkara     B)Sehwag C) Steyn D)Compilation error  

26.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   switch(0X0)
   {
       case NULL:printf("Thierry Henry");
            break;
       case '\0':printf("Steven Gerrend");
            break;
       case 0: printf("Kaka");
            break;
       default: printf("Michael Ballack");
       }
      }
A) Thierry Henry   B) Steven Gerrend  
C) Kaka D) Compilation error  

27.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
    switch(5/2*6+3.0)
    {
       case 3:printf("David Beckham");
            break;
       case 15:printf("Ronaldinho");
            break;
       case 0:printf("Lionel Messi");
            break;
        default:printf("Ronaldo");
         }  
}
A) David Beckham   B) Ronaldinho 
C) Lionel Messi   D) Compilation error  

28.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   printf("%d\t",sizeof(6.5));
   printf("%d\t",sizeof(90000));
   printf("%d",sizeof('A'));
}
A) 4 2 1   B) 8 2 2
C) 4 4 1   D) 8 4 1

29.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   signed x;
   unsigned y;
   x = 10 +- 10u + 10u +- 10;
    y = x;
   if(x==y)
        printf("%d %d",x,y);
   else if(x!=y)
        printf("%u  %u",x,y);
}
A) 0 0            B)65536 -10                C) 0 65536     D) 65536 0
  
30.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   double num=5.2;
   int  var=5;
   printf("%d\t",sizeof(!num));
   printf("%d\t",sizeof(var=15/2));
   printf("%d",var);
}
A) 4 2 7             B) 4 4 5                C)2 2 7          D) 247

31.What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
   int a=-5;
   unsigned int b=-5u;
   if(a==b)
        printf("Avatar");
   else
        printf("Alien");
}
A) Avatar    B) Alien   C)Run time error    D) Error: Illegal assignment  

32.What will be output of the following c program?
#include<stdio.h> 
int main()
{
long int 1a=5l;
printf("%ld",1a);
       return 0;
}
A) 5     B) 51         C) 6 D) Compilation Error 

33.What will be output of the following c program?
#include<stdio.h>
int main()
{
   int class=150;
   int public=25;
   int private=30;
   class = class >> private - public;
   printf("%d",class);
   return 0;
}
A) 1          B) 2          C) 4       D) Compilation Error 

34.What will be output of the following c program?
#include<stdio.h>
int main()
{
   int abcdefghijklmnopqrstuvwxyz123456789=10;
   int abcdefghijklmnopqrstuvwxyz123456=40;
   printf("%d",abcdefghijklmnopqrstuvwxyz123456);
   return 0;
}
A) 10          B) 40              C) 50          D) Compilation Error 

35.What will be output of following c code?         
#include<stdio.h>
int main()
{
    int i=2,j=2;
while(i+1?--i:j++)
       printf("%d",i);
       return 0;
}
A) 0 B) 2                 C) 1                  D) 3

36.What will be output of following c code?
#include<stdio.h>
int main()
{
   int x=011,i;
   for(i=0;i<x;i+=3)
   {
          printf("Start ");
        continue;
                printf("End");
       }
       return 0;
}
A) Start End Start End       B)Start End Start
C) Start Start Start               D)Compilation Error 

37.What will be output of following c code?
#include<stdio.h>
int main()
{
int i,j;
   i=j=2,3;
   while(--i&&j++)
        printf("%d %d",i,j);
   return 0;
}
A) 12                   B) 13                    C) 14                  D) Compilation Error 

38.What will be output of following c code?
#include<stdio.h>
int main()
{
   int i;
   for(++i;++i;++i) 
   {
        printf("%d ",i);
          if(i==4) 
 break;
   }
   return 0;
}
A) 21        B) 22        C) 24      D) 25  

39.What will be output of following c code?
#include<stdio.h>
int main()
{
   int i=1;
   for(i=0;i=-1;i=1) 
   {
        printf("%d ",i);
        if(i!=1) break;
   }
   return 0;
}
A) 0                           B) 1               C) -1          D) Compilation Error 

40.What will be output of following c code?
#include<stdio.h>
int main()
{
   int i;
   for(i=0;i<=5;i++);
   printf("%d",i)
   return 0;
}
A)  5     B) 6      C) 4           D) 7

0 comments: