C & Circuit Debugging | Engineer's Day

30 Questions | Total Attempts: 43

SettingsSettingsSettings
Please wait...
C & Circuit Debugging | Engineer

Questions and Answers
  • 1. 
    What is the output of this program?#include int main(){int a = 0;a = 1 + (a++);printf("%d", a);return 0;}
    • A. 

      2

    • B. 

      1

    • C. 

      0

    • D. 

      3

  • 2. 
    What is the output of this program?int main(){int a = 0;for(; a <= 10; a++);printf("%d", a);}
    • A. 

      10

    • B. 

      11

    • C. 

      12

    • D. 

      9

  • 3. 
    What is the output of this program?int main(){int a = 0;for(a = 0; a <= 10; a++)for( a = 0; a <= 10; a++);printf("%d", a);return 0;}
    • A. 

      10

    • B. 

      12

    • C. 

      11

    • D. 

      9

  • 4. 
    What is the output of this program?int main(){int a = 0;for(a = 0; a <= 10; a++)for( a = 0; a <= 10; a++)for(a = 0; a <= 100; a++); printf("%d", a);return 0;}
    • A. 

      103

    • B. 

      101

    • C. 

      13

    • D. 

      11

  • 5. 
    What is the output of this program?void rec(int);int main(){int a = 10;rec(10);return 0;}void rec(int a){if(a == 0)return;printf("%d", a);rec(--a);}
    • A. 

      10987654321

    • B. 

      12345678910

    • C. 

      1086420

    • D. 

      109876543210

  • 6. 
    What is the output this program?int main(){int a = -10;while(a){a++;}printf("%d", a);return 0;}
    • A. 

      10

    • B. 

      0

    • C. 

      -1

    • D. 

      1

  • 7. 
    What is the output of this program?int main(){int a = 65;char c = a;printf("%d %c", c, a);}
    • A. 

      65 A

    • B. 

      A 65

    • C. 

      65 65

    • D. 

      A A

    • E. 

      Compile time error

    • F. 

      Run time error

  • 8. 
    What is the output of this C snippet?int main(){int a = 65;char c = a;int d = a + c;printf("%d", d);}
    • A. 

      130

    • B. 

      120

    • C. 

      135

    • D. 

      Compile time error

    • E. 

      Runtime error

  • 9. 
    What is the output of this program?void main(){int k;for (k = -3; k < -5; k++)printf("Hello");}
    • A. 

      Hello

    • B. 

      Infinite Hello

    • C. 

      Runtime error

    • D. 

      Nothing

  • 10. 
    What is the output of this C snippet?int main(){int i = 0;for (i++; i == 1; i = 2)printf("%d ", i);printf("%d", i);}
    • A. 

      1 2

    • B. 

      1 2 4 5 6

    • C. 

      0 1 2

    • D. 

      0 1

  • 11. 
    What is the output of this C code?int main(){int x = 2, y = 2;float f = y + x /= x / y;printf("%d %f\n", x, f);return 0;}
    • A. 

      Compile time error

    • B. 

      2 4.000000

    • C. 

      2 3.000000

    • D. 

      Undefined behaviour

  • 12. 
    What is the output of this C code?int main(){int x = 1, y = 2;if (x && y == 1)printf("true\n");elseprintf("false\n");}
    • A. 

      False

    • B. 

      True

    • C. 

      Compile time error

    • D. 

      Runtime error

  • 13. 
    What is the output of this C code?int main(){int x = 1, y = 2;int z = x & y == 2;printf("%d\n", z);}
    • A. 

      0

    • B. 

      1

    • C. 

      Compile time error

    • D. 

      Undefined behaviour

  • 14. 
    What is the output of this C code?int main(){int x = 0, y = 2;if (!x && y)printf("true\n");elseprintf("false\n");}
    • A. 

      True

    • B. 

      False

    • C. 

      Compile time error

    • D. 

      Undefined behaviour

  • 15. 
    What is the output of this C code?void main(){int k = 4;float k = 4;printf("%d", k)}
    • A. 

      Compile time error

    • B. 

      4

    • C. 

      4.000000

    • D. 

      4.400000

  • 16. 
    A variable declared in a function can be used in main.
    • A. 

      True

    • B. 

      False

    • C. 

      True if it is declared static

    • D. 

      None of the mentioned

  • 17. 
    What is the output of this C code?int main(){int x = 2, y = 0;int z = (y++) ? y == 1 && x : 0;printf("%d\n", z);return 0;}
    • A. 

      0

    • B. 

      1

    • C. 

      Undefined behaviour

    • D. 

      Compile time error

  • 18. 
    What is the output of this C code?#includeint main(){int x = 1;short int i = 2;float f = 3;if (sizeof((x == 2) ? f : i) == sizeof(float))printf("float\n");else if (sizeof((x == 2) ? f : i) == sizeof(short int))printf("short int\n");}
    • A. 

      Float

    • B. 

      Short int

    • C. 

      Undefined behaviour

    • D. 

      Compile time error

  • 19. 
    What is the output of this C code?int main(){int a = 2;int b = 0;int y = (b == 0) ? a :(a > b) ? (b = 1): a;printf("%d\n", y);}
    • A. 

      1

    • B. 

      Compile time error

    • C. 

      2

    • D. 

      Undefined behaviour

  • 20. 
    What is the output of this C code?void main(){1 < 2 ? return 1 : return 2;}
    • A. 

      Returns 1

    • B. 

      Returns 2

    • C. 

      Varies

    • D. 

      Compile time error

  • 21. 
    What is the output of this C code?int main(){switch (printf("Do")){case 1:printf("First\n");break;case 2:printf("Second\n");break;default:printf("Default\n");break;}}
    • A. 

      Do

    • B. 

      DoFirst

    • C. 

      DoSecond

    • D. 

      DoDefault

  • 22. 
    Comment on the output of this C Code?int main(){int a = 1;switch (a){case 1:printf("%d", a);case 2:printf("%d", a);case 3:printf("%d", a);default:printf("%d", a);}}
    • A. 

      No error, output is 1111

    • B. 

      No error, output is 1

    • C. 

      Compile time error, no break statement

    • D. 

      Compile time error, case label outside switch statement

  • 23. 
    Switch statement accepts _______.
    • A. 

      Int

    • B. 

      Char

    • C. 

      Long

    • D. 

      All of the mentioned

  • 24. 
    Comment on the output of this C code?int main(){int a = 1;switch (a){case a:printf("Case A ");default:printf("Default");}}
    • A. 

      Output: Case A

    • B. 

      Output: Default

    • C. 

      Output: Case A Default

    • D. 

      Compile time Error

  • 25. 
    What is the output of this code having void return-type function?void foo(){return 1;}void main(){int x = 0;x = foo();printf("%d", x);}
    • A. 

      1

    • B. 

      0

    • C. 

      Runtime error

    • D. 

      Compile time error

Back to Top Back to top