Quiz Programming Languages(C,C++,Java)

15 Questions | Attempts: 398
Share

SettingsSettingsSettings
C Programming Quizzes & Trivia

Quit


Questions and Answers
  • 1. 

    What will be output if you will compile and execute the following c code? #include int main(){   int a=5;   float b;   printf("%d",sizeof(++a+b));   printf(" %d",a);   return 0; }

    • A.

      2 6

    • B.

      4 6

    • C.

      2 5

    • D.

      4 5

    • E.

      Compiler error

    Correct Answer
    D. 4 5
  • 2. 

     What will be output if you will compile and execute the following c code? #include int main(){   char *str;   scanf("%[^\n]",str);   printf("%s",str);   return 0; }

    • 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

    • E.

      None of above

    Correct Answer
    B. It will accept a sentence as a string from user.
  • 3. 

    What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){   int array[3]={5};   int i;   for(i=0;i<=2;i++)     printf("%d ",array[i]);   return 0; }

    • A.

      5 garbage garbage

    • B.

      5 0 0

    • C.

      5 null null

    • D.

      Compiler error

    • E.

      None of above

    Correct Answer
    B. 5 0 0
  • 4. 

    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

    Correct Answer
    B. 12 11 11
  • 5. 

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

    • A.

      Garbage Garbage Garbage

    • B.

      5 10 15

    • C.

      15 10 5

    • D.

      Compiler error

    • E.

      Run time error

    Correct Answer
    C. 15 10 5
  • 6. 

    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

    Correct Answer
    E. Compiler error
  • 7. 

    What will be output if you will compile and execute the following c code? #include 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

    Correct Answer
    C. 5 11
  • 8. 

    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

    Correct Answer
    C. )+INF
  • 9. 

    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

    Correct Answer
    B. -18
  • 10. 

    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 the above

    Correct Answer
    A. 18
  • 11. 

     How many types of representation are in string?

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    Correct Answer
    B. 2
  • 12. 

    Which is used to return the number of characters in the string?

    • A.

      Length

    • B.

      Size

    • C.

      Both a & b

    • D.

      None of the mentioned

    Correct Answer
    C. Both a & b
  • 13. 

    Which method do we use to append more than one character at a time?

    • A.

      Append

    • B.

      Operator+=

    • C.

      Data

    • D.

      Both a & b

    Correct Answer
    D. Both a & b
  • 14. 

    Which four options describe the correct default values for array elements of the types indicated?
    1. int -> 0
    2. String -> "null"
    3. Dog -> null
    4. char -> '\u0000'
    5. float -> 0.0f
    boolean -> true

    • A.

      1, 2, 3, 4

    • B.

      1, 3, 4, 5

    • C.

      2, 4, 5, 6

    • D.

      3, 4, 5, 6

    Correct Answer
    B. 1, 3, 4, 5
  • 15. 

    Which one of these lists contains only Java programming language keywords?          

    • A.

      Class, if, void, long, Int, continue

    • B.

      Goto, instanceof, native, finally, default, throws

    • C.

      Try, virtual, throw, final, volatile, transient

    • D.

      Strictfp, constant, super, implements, do

    • E.

      Byte, break, assert, switch, include

    Correct Answer
    B. Goto, instanceof, native, finally, default, throws

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 13, 2013
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 13, 2013
    Quiz Created by
    Sathishme
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.