1.   
  What is the output?
int main()
{

  printf("%d",sizeof("a"));
}

 

    Choice1: 2 
    Choice2: 1 
    Choice3: error 
    Choice4: none 
    Answer: 1 

--------------------------------------------------------------------------------
2.   
  What is a dangling pointer? 

    Choice1: A pointer that points to nothing 
    Choice2: A dereferenced pointer 
    Choice3: A pointer that points to resgister variables 
    Choice4: non 
    Answer: 2 

--------------------------------------------------------------------------------
3.   
  What is the output?
int main()
{
  printf("%d",sizeof char);
} 

    Choice1: 2 
    Choice2: 1 
    Choice3: error 
    Choice4: none 
    Answer: 3 

--------------------------------------------------------------------------------
4.   
   What is the output(machine is 16 bit)?
int main()
{
  char * test;
  printf("%d",sizeof(test));
}
   

    Choice1: 2 
    Choice2: 4 
    Choice3: 0 
    Choice4: error 
    Answer: 2 

--------------------------------------------------------------------------------
5.   
  What is the output?
int main()
{
  int j,aa[5];
  j=0;
  aa[j]=j=++j;
  printf("%d %d %d",j,aa[0],aa[1]);
}
 

    Choice1: 1 0 1 
    Choice2: 1 1 garbage 
    Choice3: garbage 
    Choice4: error 
    Answer: 2 

--------------------------------------------------------------------------------
6.   
  What is the output?
int main()
{
  extern int f(float);
  int a;
  a = f(3.14);
  printf("%d",a);
}
float f(float aa)
{
  return ((int)aa);
}
 

    Choice1: 3.14 
    Choice2: 0 
    Choice3: 3 
    Choice4: error 
    Answer: 3 

--------------------------------------------------------------------------------
7.   
  Output ?
int main()
{
  const int x=5;
  int *ptr;
  ptr=&x;
  *ptr=10;
  printf("%d",x);
}
 

    Choice1: error 
    Choice2: compiler dependent 
    Choice3: 10 
    Choice4: 0 
    Answer: 2 

--------------------------------------------------------------------------------
8.   
  Where is NULL defined?
 

    Choice1: stdlib.h 
    Choice2: stdddef.h 
    Choice3: process.h 
    Choice4: ctype.h 
    Answer: 1 

--------------------------------------------------------------------------------
9.   
    What is the output?

# define sum(x,y) x * y
int main ()
{
int a = 3 , b = 4 ;
int c = sum(a+2,b+1);
printf ("%d" , c ) ; 
return 0;
}

   

    Choice1: 12 
    Choice2: 25 
    Choice3: error 
    Choice4: 13 
    Answer: 1 

--------------------------------------------------------------------------------
10.   
  What is the output?
int main()
{
  int p=2,q=3,j=1,k;
  k=((p>q)?p:q)*(j=0?j:-j);
  printf("%d",k);
}
 

    Choice1: -3 
    Choice2: 3 
    Choice3: 2 
    Choice4: 0 
    Answer: 1 

--------------------------------------------------------------------------------
11.   
  What is the output?
int main()
{
  register int i=3;
  printf("%u",&i);
}
 

    Choice1: compiler dependent 
    Choice2: address of i 
    Choice3: 3 
    Choice4: error 
    Answer: 4 

--------------------------------------------------------------------------------
12.   
  What is the output?

#define ONE 1
#define TWO 1+1-1
int main()
{
  printf("%d %d",TWO+ONE-ONE,TWO-ONE);
}
 

    Choice1: error 
    Choice2: 1 0 
    Choice3: 0 1 
    Choice4: 1 1 
    Answer: 2 

--------------------------------------------------------------------------------
13.   
  What is the output of the following code?

int main()
{
 int i=6,*p;
 p= &i;
 printf("%d",i/*p);
} 

    Choice1: 1 
    Choice2: 6 
    Choice3: error 
    Choice4: god only knows 
    Answer: 3 

--------------------------------------------------------------------------------
14.   
  What is the error?
int main()
{
 _exit();
} 

    Choice1: no error 
    Choice2: it is exit() and not _exit() 
    Choice3: run time error 
    Choice4: compile time error beacuse of something else 
    Answer: 1 

--------------------------------------------------------------------------------
15.   
  What is the output?
struct status_type
{
  unsigned cts:1;
  unsigned rts:1;
}status;
int main()
{
  status.cts=1;
  status.rts=0;
  printf("%d %d",(status.rts  

		        Choice1:  1 0 
		        Choice2: error  
		        Choice3:  0 1  
		        Choice4:  compiler dependent  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  16.   
		      What is the output?
int main()
{
  static int a[]={0,1,2,3,4};
  static int *p[]={a,a+1,a+2,a+3};
  int **ptr;
  ptr=p;
  **ptr++;
  printf("%d %d %d",ptr-p,*ptr-a,**ptr);
  *++*ptr;
  printf("%d %d %d",ptr-p,*ptr-a,**ptr);
  ++*ptr;
  printf("%d %d %d",ptr-p,*ptr-a,**ptr);
}
   

		        Choice1:  1 1 11 2 21 3 3 
		        Choice2: 1 1 11 1 21 3 3  
		        Choice3:  1 0 11 2 21 3 3  
		        Choice4:  error  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  17.   
		      What is the output?
int main()
{
  int i=50,b=5;
  printf("%d%%%d",i,b);
}

   

		        Choice1:  50%5 
		        Choice2: 5%50  
		        Choice3:  error  
		        Choice4:  god only knows  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  18.   
		      #define aa 100
int main()
{
  aa++;
  printf("%d",aa);
}   

		        Choice1:  101 
		        Choice2: 100  
		        Choice3:  error  
		        Choice4:  102  
        Answer:  3  
		   --------------------------------------------------------------------------------  
 
               
  19.   
		      What is the output?
int main()
{
  printf(" %d",printf("Placement Ctest")-1);
}

   

		        Choice1:  Placement Ctest 14 
		        Choice2: 14 Placement Ctest  
		        Choice3:  Placement Ctest 15  
		        Choice4:  erro  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  20.   
		      Output?(sizeof int is 2,float is 4)
void main()
{
  int i=10;float j=20;
  printf("%d",sizeof(i+j));
}
   

		        Choice1:  4 
		        Choice2: 2  
		        Choice3:  error  
		        Choice4:  2  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  21.   
		      int main()
{
  printf("%d %d %d",5,!5,!!5);printf("%c",7);
}

   

		        Choice1:  5 0 1 
		        Choice2: 5 25 125  
		        Choice3:  5 1 1  
		        Choice4:  error  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  22.   
		      Output?
int main()
{
  int *x=10,*x1=12;
  printf("%d",*x**x1);
}

   

		        Choice1:  compile time error 
		        Choice2: run time error  
		        Choice3:  120  
		        Choice4:  10  
        Answer:  2  
		   --------------------------------------------------------------------------------  
 
               
  23.   
		      output?
int main()
{
  int n=10,x=5;
  printf("%*d %1.*f",x,n,x,3.14157524);
}

   

		        Choice1:  10 3.14158 
		        Choice2: 10 5  
		        Choice3:  5 3.14158  
		        Choice4:  error  
        Answer:  1  
		   --------------------------------------------------------------------------------  
 
               
  24.   
		      What is the output?
int main()
{
  int count=0;
  printf("This is %na test",&count);
  printf(%d",count);
}
   

		        Choice1:  Thiis is a test 
		        Choice2: This is n a test  
		        Choice3:  compile tim error  
		        Choice4:  run time error  
        Answer:  3  
		   --------------------------------------------------------------------------------  
 
               
  25.   
		      Why null pointer exception occurs?   

		        Choice1:  Because pointer tries to access zero address 
		        Choice2: when type casting pointers  
		        Choice3:  When pointers value is null  
		        Choice4:  there is no such exception  
        Answer:  1 
