Trivia: Test On Output Of C Programs! Quiz

10 Questions | Total Attempts: 55

SettingsSettingsSettings
Please wait...
Trivia: Test On Output Of C Programs! Quiz

Are you a computer programmer looking for a way to refresh what you know when it comes to the output of C programs? If you said yes, then you are in luck as the quiz is prepared to help you do just that. Give it a try and see if beyond might need to spend more hours studying for your finals.


Questions and Answers
  • 1. 
    What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?
    • A. 

      10

    • B. 

      9

    • C. 

      0

    • D. 

      1

  • 2. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> void call(int,int,int); int main(){   int a=10;   call(a,a++,++a);   return 0; } void call(int x,int y,int z){   printf("%d %d %d",x,y,z); }
    • A. 

      10 10 12

    • B. 

      12 11 11

    • C. 

      12 12 12

    • D. 

      10 11 12

    • E. 

      Compiler Error

  • 3. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   register int i,x;   scanf("%d",&i);   x=++i + ++i + ++i;   printf("%d",x);   return 0; }
    • A. 

      17

    • B. 

      18

    • C. 

      21

    • D. 

      22

    • E. 

      Compiler Error

  • 4. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   int a=5;   int b=10;   {     int a=2;     a++;     b++;   }   printf("%d %d",a,b);   return 0; }
    • A. 

      5 10

    • B. 

      6 11

    • C. 

      5 11

    • D. 

      6 10

    • E. 

      Compiler error

  • 5. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   float f=3.4e39;   printf("%f",f);   return 0; }
    • A. 

      3.4e39

    • B. 

      3.40000…

    • C. 

      +INF

    • D. 

      Compiler error

    • E. 

      Run time error

  • 6. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   enum color{     RED,GREEN=-20,BLUE,YELLOW   };   enum color x;   x=YELLOW;   printf("%d",x);   return 0; }
    • A. 

      -22

    • B. 

      -18

    • C. 

      1

    • D. 

      Compiler error

    • E. 

      None of the above

  • 7. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   asm{     mov bx,8;     mov cx,10     add bx,cx;   }   printf("%d",_BX);   return 0; }
    • A. 

      18

    • B. 

      8

    • C. 

      0

    • D. 

      Compiler error

    • E. 

      None of above

  • 8. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   enum xxx{      a,b,c=32767,d,e   };   printf("%d",b);   return 0; }
    • A. 

      0

    • B. 

      1

    • C. 

      32766

    • D. 

      Compiler error

    • E. 

      None of above

  • 9. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   char *url="c:\tc\bin\rw.c";   printf("%s",url);   return 0; }
    • A. 

      C:\tc\bin\rw.c

    • B. 

      C:/tc/bin/rw.c

    • C. 

      C: c inw.c

    • D. 

      C:cinw.c

    • E. 

      W.c in

  • 10. 
    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   goto abc;   printf("main");   return 0; } void dispaly(){   abc:     printf("display"); }
    • A. 

      Main

    • B. 

      Display

    • C. 

      Maindisplay

    • D. 

      Displaymain

    • E. 

      Compiler error