Test2

  1. What is the output of following program?
    #include<stdio.h>
    double i;
    int main()
    {
    (int)(float)(char) i;
    printf("%d", sizeof((int)(float)(char)i));
    }
    1       4       Compiler Error       None      
  2. What is the output of following program?
    #include<stdio.h>
    #define X a##b
    int main()
    {
    int a=2,b=3,ab=5;
    printf("%d", a+b+X);
    }
    Compiler Error       2       3       10      
  3. What is the output of following program?
    #include<stdio.h>
    #define square(x) x*x
    int main()
    {
    printf("%d", square(2+3));
    }
    11       25       4       9      
  4. What is the output of following program?
    #include<stdio.h>
    static int i=5;
    int main(){
    int i=2,j,k;
    j=i++;
    k=++i;
    printf("%d,%d,%d",i,j,k);
    }
    7 5 7       7,5,7       4,2,4       4 2 4      
  5. What is the output of following program?
    #include<stdio.h>
    int main()
    {
    int k=1;
    printf("%d == 1 is" "%s\n", k, k==1?"True":"False");
    }
    1 == 1 is True       1 == 1 is False       Compiler Error       None      


  6. What is the output of following program?
    #include<stdio.h>
    int main(){
    int i;
    printf("%d\n", scanf("%d", &i));
    }
    0       1       2       4      
  7. What is the output of following program?
    #include<stdio.h>
    int main()
    {
    printf(6-2+"RISE_KRISHNA_SAI");
    }
    RISE_KRISHNA_SAI       _KRISHNA_SAI       Compiler Error       None      
  8. What is the output of following program?
    #include<stdio.h>
    #include<string.h>
    int main()
    {
    char clg1[5]="rpra",clg2[5]="rgan";
    printf("%d",strcmp(clg1,clg2));
    }
    -1       0       1       None      
  9. What is the output of following program?
    #include<stdio.h>
    int main()
    {
    char name=255;
    printf("%d",name);
    }
    0       1       -1       None      
  10. What is the output of following program?
    #include<stdio.h>
    int main()
    {
    int i=1;
    for(;i<10;i++);
    printf("%d",--i);
    }
    10       9       Compiler Error       None      

No comments:

Post a Comment

Total Pageviews