Encrypt Da Logic In C

35 Questions | Total Attempts: 45

SettingsSettingsSettings
C Programming Quizzes & Trivia

This quiz is based on knowledge in C.


Questions and Answers
  • 1. 
     What will be output if you will compile and execute the following c code?#define x 5+2 printf("%d",i); 
    • A. 

      343

    • B. 

      27

    • C. 

      133

    • D. 

      None of above

  • 2. 
    ) What will be output if you will compile and execute the following c code?void main(){int i=320;char *ptr=(char *)&i;printf("%d",*ptr); 
    • A. 

      320

    • B. 

      1

    • C. 

      64

    • D. 

      Compile Error

  • 3. 
    What will be output if you will compile and execute the following c code?void main(){int a=2;if(a==2){a=~a+2<<1; } { break;
    • A. 

      It will print nothing.

    • B. 

      -3

    • C. 

      -2

    • D. 

      -2

    • E. 

      Compile Error

  • 4. 
    • A. 

      11Hello world

    • B. 

      10Hello world

    • C. 

      Hello world10

    • D. 

      Hello world11

    • E. 

      Compile Error

  • 5. 
    What will be output if you will compile and execute the following c code?#include "stdio.h"#include "string.h"void main(){char *str=NULL;strcpy(str,"cquestionbank"); }  
    • A. 

      Cquestionbank

    • B. 

      Cquestionbank\0

    • C. 

      (null)

    • D. 

      It will print nothing

  • 6. 
    What will be output if you will compile and execute the following c code?void main(){printf("%d",sizeof(5.2)); 
    • A. 

      2

    • B. 

      4

    • C. 

      8

    • D. 

      10

  • 7. 
    What will be output if you will compile and execute the following c code?#include "stdio.h"#include "string.h"void main(){char c='\08';printf("%d",c); 
    • A. 

      8

    • B. 

      ’8’

    • C. 

      9

    • D. 

      Null

    • E. 

      Compile Error

  • 8. 
    What will be output if you will compile and execute the following c code?#define call(x,y) x }  
    • A. 

      35

    • B. 

      510

    • C. 

      40

    • D. 

      15

  • 9. 
    What will be output if you will compile and execute the following c code?int * call(); } int a=25;a++;
    • A. 

      25

    • B. 

      26

    • C. 

      Any Address

    • D. 

      Garbage Value

  • 10. 
    What is error in following declaration?   };  
    • A. 

      Nesting of structure is not allowed in c.

    • B. 

      It is necessary to initialize the member variable.

    • C. 

      Inner structure must have name.

    • D. 

      Outer structure must have name.

  • 11. 
    What will be output if you will compile and execute the following c code?void main(){int array[]={10,20,30,40};printf("%d",-2[array]); 
    • A. 

      -60

    • B. 

      -30

    • C. 

      60

    • D. 

      Garbage Value

  • 12. 
    Void main(){int i=10;static int x=i;if(x==i)printf("Equal"); printf("Less than");}  
    • A. 

      Equal

    • B. 

      Greater than

    • C. 

      Less than

    • D. 

      Compile Error

  • 13. 
    What will be output if you will compile and execute the following c code?void main(){int i=5,j=2;if(++i>j++||i++>j++)printf("%d",i+j); 
    • A. 

      7

    • B. 

      11

    • C. 

      8

    • D. 

      9

  • 14. 
    What will be output if you will compile and execute the following c code?void main(){double far* p,q; }
    • A. 

      12

    • B. 

      8

    • C. 

      4

    • D. 

      1

  • 15. 
    What will be output if you will compile and execute the following c code?   printf("%s",str); 
    • A. 

      It will accept a word as a string from user.

    • B. 

      It will accept a sentence as a string from user.

    • C. 

      It will accept a paragraph as a string from user.

    • D. 

      Compiler error

  • 16. 
    What will be output if you will compile and execute the following c code?void main(){int a=5,b=10,c=15;int *arr[]={&a,&b,&c};printf("%d",*arr[1]); 
    • A. 

      5

    • B. 

      10

    • C. 

      15

    • D. 

      Compile Error

  • 17. 
    What will be output if you will compile and execute the following c code?
    • A. 

      4

    • B. 

      5

    • C. 

      6

    • D. 

      7

    • E. 

      8

  • 18. 
    What will be output if you will compile and execute the following c code?void main(){int x=5,y=10,z=15;printf("%d %d %d"); }  
    • A. 

      Garbage Garbage Garbage

    • B. 

      5 10 15

    • C. 

      15 10 5

    • D. 

      Compiler error

  • 19. 
    What will be output if you will compile and execute the following c code?void main(){register int i,x; x=++i + ++i + ++i; }  
    • A. 

      17

    • B. 

      18

    • C. 

      21

    • D. 

      22

    • E. 

      Compile Error

  • 20. 
    What will be output if you will compile and execute the following c code?void main(){int a=5;int b=10;{ b++; printf("%d %d",a,b); }  
    • A. 

      5 10

    • B. 

      6 11

    • C. 

      5 11

    • D. 

      6 10

  • 21. 
    What will be output if you will compile and execute the following c code?void main(){float f=3.4e39;printf("%f",f); 
    • A. 

      3.4e39

    • B. 

      3.40000......

    • C. 

      +INF

    • D. 

      Compile Error

    • E. 

      Runtime Error

  • 22. 
    What will be output if you will compile and execute the following c code?void main(){signed int a=-1;unsigned int b=-1; printf("Not equal"); }
    • A. 

      -1 -1

    • B. 

      -1 32767

    • C. 

      -1 -32768

    • D. 

      Not Equal

  • 23. 
    What will be output if you will compile and execute the following c code?void main(){float f=5.5f;float x;x=f%2; }  
    • A. 

      1.500000

    • B. 

      1.000000

    • C. 

      5.500000

    • D. 

      Compile Error

  • 24. 
    What will be output if you will compile and execute the following c code?void main(){char c='0';printf("%d %d",sizeof(c),sizeof('0')); }  
    • A. 

      1 1

    • B. 

      2 2

    • C. 

      1 2

    • D. 

      2 1

  • 25. 
    What will be output if you will compile and execute the following c code?void main(){clrscr(); getch(); void dispaly(){abc: }
    • A. 

      Main

    • B. 

      Display

    • C. 

      Maindisplay

    • D. 

      Displaymain

    • E. 

      Compile error

Back to Top Back to top