Test - 4

Time left =
  1. What is the output of the following program?
      #include<stdio.h>
      main(){
      int i = 1;
      while(++i <= 5)
      printf("%d ",i++);
      }
    1 3 5       2 4       2 4 6       2      
  2. What is the output of the below code snippet?
      #include<stdio.h>   main(){
      int a = 5, b = 3, c = 4;
      printf("a = %d, b = %d", a, b, c);
      }
    a=5, b=3       a=5, b=3, c=0       a=5, b=3, 0       compile error      
  3. What is the output of the following code snippet?
      #include<stdio.h>
      main(){
      short unsigned int i = 0;
      printf("%u", --i);
      }
    0       -1       65535       32767      
  4. What is the output of the following program?
      #include<stdio.h>
      main(){
      char *p = NULL;
      printf("%c", *p);
      }
    NULL       0       Compiler Error       Runtime Error      
  5. What is the outpout of the following program?
      #include<stdio.h>
      main(){
      enum { india, is=7, GREAT };
      printf("%d %d", india, GREAT);
      }
    0 1       0 2       0 8       Compiler Error      
  6. What is the output of the following program?
      #include<stdio.h>
      void f(int a[]){
      int i;
      for(i=0; i<3; i++)
      a[i]++;
      }
      main(){
      int i,a[] = {10, 20, 30};
      f(a);   for(i=0; i<3; ++i)
      printf("%d ",a[i]);
      }
    10 20 30       11 21 31       Compiler Error       Runtime Error      
  7. What is the output of the below code snippet?
      #include<stdio.h>
      main(){
      char s[]="hello", t[]="hello";
      if(s==t) printf("eqaul strings");
      }
    equal strings       unequal strings       No output       Compiler Error      
  8. What will be the output of the program?
      #include<stdio.h>
      int main(){
      int y=128;
      const int x=y;
      printf("%d", ++x);
      }
    128       Garbage value       Error       0      
  9. What will be the output of the program?
      #include<stdio.h>
      int main(){
      printf("%d",125/20&&30%5);
      }
    0       1       Garbage Value       Compile Error      
  10. What will be the output of the program?
      #include<stdio.h>
      int i=0;
      int main(){
      printf("%d",5+7&&i<<10?12:i*10);
      }
    Compile Error       Garbage Value       12       0