MCQOPTIONS
Saved Bookmarks
This section includes 67 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What will be the output of the following C code?#include <stdio.h> int main() { int n = 0; for (n) printf("Hello how are u?"); } |
| A. | Hello how are u? |
| B. | Garbage value |
| C. | Compilation Error |
| D. | Runtime Error |
| E. | None of threse |
| Answer» D. Runtime Error | |
| 2. |
What will be the output of the following C code?#include <stdio.h> void main() { int n = 0; for (n < 3; n++) printf("Hey..."); } |
| A. | Hey... |
| B. | 0 |
| C. | 3 |
| D. | Compilation Error |
| E. | None of these |
| Answer» E. None of these | |
| 3. |
What will be the output of the following C code?#include <stdio.h> int main() { short k; for (k = 1; k >= 0; k++) printf("%d n", k); } |
| A. | Numbers will be displayed until the signed limit of short and throw a runtime error |
| B. | This program will get into an infinite loop and keep printing numbers with no errors |
| C. | The control won t fall into the for loop |
| D. | Numbers will be displayed until the signed limit of short and program will successfully terminate |
| E. | None of these |
| Answer» E. None of these | |
| 4. |
What will be the output of the following C code?#include <stdio.h> int main() { while () printf("Executed In while loop "); printf("Executed After loop n"); } |
| A. | Executed After loop |
| B. | Compilation Error |
| C. | Infinite loop |
| D. | Executed In while loop |
| E. | None of these |
| Answer» C. Infinite loop | |
| 5. |
What will be the output of the following C code?#include <stdio.h> int main() { for (int k = 0; k < 1; k++) printf("Executed In for loop n"); } |
| A. | Executed In for loop |
| B. | Depends on the compiler |
| C. | Compilation Error |
| D. | Depends on the standard compiler implements |
| E. | None of these |
| Answer» E. None of these | |
| 6. |
What will be the output of the following C code? #include <stdio.h> int main() { int *ptr = NULL; for (fun(); ptr; ptr = 0) printf("Executed in loop n"); printf("Executed After loop n"); } |
| A. | Compilation Error |
| B. | Executed in loop |
| C. | Executed After loop |
| D. | Infinite loop |
| E. | Depends on the value of NULL |
| Answer» B. Executed in loop | |
| 7. |
What will be the output of the following C code?#include <stdio.h> int main() { int k = 0; for (fun(); k == 1; k = 2) printf("Executed in loop n"); printf("Executed After loop n"); } int fun() { return 1; } |
| A. | Infinite loop |
| B. | Compilation Error |
| C. | Executed in loop |
| D. | Executed After loop |
| E. | None of these |
| Answer» E. None of these | |
| 8. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 0; while (++k) { printf("Interview Mania"); } } |
| A. | Compilation Error |
| B. | "Interview Mania" one time |
| C. | "Interview Mania" infinite times |
| D. | Runtime Error |
| E. | None of these |
| Answer» D. Runtime Error | |
| 9. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 4; do { printf("Interview Mania n"); } while (k < 3); } |
| A. | Compilation Error |
| B. | Runtime Error |
| C. | "Interview Mania" one time |
| D. | Garbage value |
| E. | None of these |
| Answer» D. Garbage value | |
| 10. |
How many times k value is checked in the following C code?#include <stdio.h> int main() { int k = 0; while (k <= 5) { printf("Executed In while loop n"); k++; } } |
| A. | 3 |
| B. | 4 |
| C. | 5 |
| D. | 6 |
| E. | None of these |
| Answer» E. None of these | |
| 11. |
How many times k value is checked in the following C code?#include <stdio.h> int main() { int k = 0; do { k++; printf("Executed in while loop n"); } while (k < 5); } |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| E. | 5 |
| Answer» F. | |
| 12. |
How many times while loop condition is tested in the following C code snippets, if k is initialized to 0 in both the cases?while (k < m) k++; - do k++; while (k <= m); |
| A. | m+1, m |
| B. | m+1, m+1 |
| C. | m, m |
| D. | m, m+1 |
| E. | None of these |
| Answer» C. m, m | |
| 13. |
What will be the output of the following C code?#include <stdio.h>void main(){ int k = 0; while (k < 3) { k++; printf("Hello n"); while (k < 5) { k++; printf("Interview Mania n"); } }} |
| A. | Hello is printed 1 times, Interview Mania 1 times |
| B. | Hello is printed 4 times, Interview Mania 4 times |
| C. | Hello is printed 1 times, Interview Mania 4 times |
| D. | All of above |
| E. | None of these |
| Answer» D. All of above | |
| 14. |
What will be the output of the following C code?#include <stdio.h> void main() { char *S = ""; do { printf("Krishana"); } while (S); } |
| A. | S |
| B. | "Krishana" one time |
| C. | "Krishana" infinite times |
| D. | Nothing |
| E. | None of these |
| Answer» D. Nothing | |
| 15. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 1; do { printf("Interview Mania"); } while (k != 1); } |
| A. | "Interview Mania" infinite times |
| B. | Compilation Error |
| C. | "Interview Mania" one time |
| D. | Nothing |
| E. | None of these |
| Answer» D. Nothing | |
| 16. |
What will be the output of the following C code?#include <stdio.h> int main() { int p = 0, k = 0, q = 1; for (k = 0; k < 10; k++) { p++; q++; continue; } printf("%d, %d", p, q); } |
| A. | 0, 10 |
| B. | 10, 0 |
| C. | 11, 10 |
| D. | 10, 11 |
| E. | None of these |
| Answer» E. None of these | |
| 17. |
What will be the output of the following C code? #include <stdio.h> void main() { int k = 0; int L = 0; for (k = 0; k < 4; k++) { for (L = 0; L < 3; L++) { if (k > 1) continue; printf("Interview Mania n"); } } } |
| A. | Compilation Error |
| B. | "Interview Mania" is printed 6 times |
| C. | "Interview Mania" is printed 5 times |
| D. | "Interview Mania" is printed 4 times |
| E. | None of these |
| Answer» C. "Interview Mania" is printed 5 times | |
| 18. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 0, L = 0; for (k = 0; k < 3; k++) { for (L = 0; L < 5; L++) { if (k > 1) break; } printf("Interview Mania n"); } } |
| A. | "Interview Mania" is printed 1 times |
| B. | "Interview Mania" is printed 2 times |
| C. | "Interview Mania" is printed 3 times |
| D. | "Interview Mania" is printed 4 times |
| E. | "Interview Mania" is printed 5 times |
| Answer» D. "Interview Mania" is printed 4 times | |
| 19. |
What will be the output of the following C code? #include <stdio.h> int main() { int p = 0, k = 0, q; for (k = 0; k < 10; k++) { p++; if (k == 9) break; } printf("%d",p); } |
| A. | 0 |
| B. | 9 |
| C. | 10 |
| D. | All of above |
| E. | None of these |
| Answer» D. All of above | |
| 20. |
What will be the output of the following C code? #include <stdio.h> int main() { int k = 0; do { k++; if (k == 2) continue; printf("Interview"); } while (k < 2); printf(" Mania"); } |
| A. | Interview Mania |
| B. | Interview |
| C. | Mania |
| D. | Compilation Error |
| E. | None of these |
| Answer» B. Interview | |
| 21. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 5; if (k == 5) { printf("Hello Interview Mania"); break; } } |
| A. | Hello Interview Mania |
| B. | Garbage value |
| C. | Compilation Error |
| D. | Runtime Error |
| E. | None of these |
| Answer» D. Runtime Error | |
| 22. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 0; for (k = 0; k < 6; k++) if (k < 4) { printf("Interview Mania"); break; } } |
| A. | "Interview Mania" is printed 6 times |
| B. | "Interview Mania" is printed 4 times |
| C. | Interview Mania |
| D. | Compilation Error |
| E. | None of these |
| Answer» D. Compilation Error | |
| 23. |
What will be the output of the following C code?#include <stdio.h> int main() { printf("Welcome "); Level1:Level2: printf("To "); printf("Interview Maina"); } |
| A. | Welcome |
| B. | To |
| C. | Interview Maina |
| D. | Welcome To Interview Maina |
| E. | Compilation Error |
| Answer» E. Compilation Error | |
| 24. |
What will be the output of the following C code?#include <stdio.h> int main() { printf("Hello "); goto Level1; printf("Hey "); Level1:goto Level2; printf("Welcome"); Level2:printf("Interview Mania"); } |
| A. | Hello |
| B. | Hey |
| C. | Welcome |
| D. | Interview Mania |
| E. | Hello Interview Mania |
| Answer» F. | |
| 25. |
What will be the output of the following C code? #include <stdio.h> int main() { printf("Interview"); continue; printf(" Mania"); } |
| A. | Compilation Error |
| B. | Mania |
| C. | Interview |
| D. | Runtime Error |
| E. | None of these |
| Answer» B. Mania | |
| 26. |
What will be the output of the following C code?#include <stdio.h> void main() { int n = 5, L; if (n == 5) goto Read; Read: printf("%d ", n); printf("Interview Mania"); } |
| A. | 5 |
| B. | Interview Mania |
| C. | 5 Interview Mania |
| D. | Interview Mania 5 |
| E. | None of these |
| Answer» D. Interview Mania 5 | |
| 27. |
What will be the output of the following C code?#include <stdio.h> void main() { int n = 5, L; Label: printf("%d", n); if (n == 5) goto Label; } |
| A. | Nothing |
| B. | Compilation Error |
| C. | 5 Infinite times |
| D. | 5 |
| E. | None of these |
| Answer» D. 5 | |
| 28. |
What will be the output of the following C code?#include <stdio.h> void main() { int n = 0, L; if (n == 0) goto Label; for (L = 0; L < 3; L++) { printf("Hey"); Label: L = printf("%03d", n); } } |
| A. | HeyHeyHey |
| B. | 000 HeyHeyHey |
| C. | HeyHeyHey 000 |
| D. | 000 |
| E. | None of these |
| Answer» E. None of these | |
| 29. |
What will be the output of the following C code?#include <stdio.h> void main() { int k = 2; if (k == 2) { goto Lavel; } Lavel: printf("Interview Mania"); } |
| A. | Compilation Error |
| B. | Interview Mania |
| C. | Garbage value |
| D. | Runtime Error |
| E. | None of these |
| Answer» C. Garbage value | |
| 30. |
What will be the output of the following C code?#include <stdio.h> int main() { int n = 0, L = 0; while (Read: n < 25) { n++; while (L < 15) { printf("Ajit"); goto Read; } } } |
| A. | Compilation Error |
| B. | Garbage value |
| C. | Ajit |
| D. | Runtime Error |
| E. | None of these |
| Answer» B. Garbage value | |
| 31. |
What will be the output of the following C code?#include <stdio.h> int main() { int k = 0, L = 0; while (k < 2) { Read: k++; while (L < 3) { printf("Interveiw Mania"); goto Read; } } } |
| A. | "Interview Mania" is printed one time |
| B. | "Interview Mania" is printed 3 time |
| C. | "Interview Mania" is printed infinite time |
| D. | Compilation Error |
| E. | None of these |
| Answer» D. Compilation Error | |
| 32. |
What will be the output of the following C code?#include <stdio.h> int main() { printf("Krishna "); goto Label; printf("Imroj "); } void fun() { Label: printf("Abhay "); } |
| A. | Krishna |
| B. | Imroj |
| C. | Abhay |
| D. | Compilation Error |
| E. | None of these |
| Answer» E. None of these | |
| 33. |
What will be the output of the following C code? #include <stdio.h> int main() { printf("Ajit "); Label1: Label2: printf("Sumi "); printf("Abhay "); } |
| A. | Ajit |
| B. | Sumi |
| C. | Abhay |
| D. | Ajit Sumi Abhay |
| E. | Sumi Ajit Abhay |
| Answer» E. Sumi Ajit Abhay | |
| 34. |
What will be the output of the following C code?#include <stdio.h> int main() { printf("Ajit "); goto Label1; printf("Abhay "); Label1:goto Label2; printf("Sumi "); Label2:printf("Imroj "); } |
| A. | Ajit |
| B. | Imroj |
| C. | Imroj Ajit |
| D. | Ajit Imroj |
| E. | None of these |
| Answer» E. None of these | |
| 35. |
What will be the output of the following C code? #include <stdio.h> int main() { int k = 0, L = 0; while (Level1: k < 5) { k++; while (L < 6) { printf("Interveiw Maina n"); goto Level1; } } } |
| A. | "Interveiw Maina" is printed one time |
| B. | "Interveiw Maina" is printed infinite time |
| C. | Compilation Error |
| D. | Garbage value |
| E. | None of these |
| Answer» D. Garbage value | |
| 36. |
What will be the output of the following C code?#include <stdio.h> int main() { int k = 0, L = 0; while (k < 3) { Level1 : k++; while (L < 4) { printf("Interview Mania"); goto Level1; } } } |
| A. | Interview Mania |
| B. | "Interview Mania" is printed 4 times |
| C. | Compilation Error |
| D. | "Interview Mania" is printed infinite times |
| E. | None of these |
| Answer» E. None of these | |
| 37. |
What will be the output of the following C code?#include <stdio.h> int main() { printf("Interview"); goto Level1; printf("Mania"); } void fun() { Level1 : printf("Hello"); } |
| A. | Mania |
| B. | Hello |
| C. | Compilation Error |
| D. | Runtime Error |
| E. | Interview |
| Answer» D. Runtime Error | |
| 38. |
What will be the output of the following C code?#include <stdio.h> int main() { int k = 0, L = 0; while (k < 10, L < 15) { k++; L++; } printf("%d, %d n", k, L); } |
| A. | 10, 15 |
| B. | 15, 10 |
| C. | Compilation Error |
| D. | Garbage value |
| E. | 15, 15 |
| Answer» F. | |
| 39. |
What will be the output of the following C code?#include <stdio.h> int main() { int k = 0; while (k = 0) printf("Veg... n"); printf("Non-Veg... n"); } |
| A. | Veg... |
| B. | Non-Veg... |
| C. | Compilation Error |
| D. | Runtime Error |
| E. | None of these |
| Answer» C. Compilation Error | |
| 40. |
What will be the output of the following C code?#include <stdio.h> int main() { int n = 0; for (; ; ;) printf("Hey... n"); printf("Hello... n"); } |
| A. | Hey... |
| B. | Hello... |
| C. | Runtime Error |
| D. | Compilation Error |
| E. | None of these |
| Answer» E. None of these | |
| 41. |
What will be the output of the following C code? #include <stdio.h> int main() { int n; for (n = -4; n < -6; n++) printf("Hey..."); } |
| A. | Hey... |
| B. | Compilation Error |
| C. | Nothing |
| D. | Runtime Error |
| E. | None of these |
| Answer» D. Runtime Error | |
| 42. |
What will be the output of the following C code?#include <stdio.h> int main() { double L = 0; for (L = 0.0; L < 5.0; L++); printf("%f n", L); } |
| A. | 1.000000 |
| B. | 2.000000 |
| C. | 3.000000 |
| D. | 5.000000 |
| E. | None of these |
| Answer» E. None of these | |
| 43. |
In the program given below, point out the error, if any, in the while loop. #include <studio.h>int main(){ int k = 5; while ( ) { printf("%d n", k++); if (k >10) break; } return 0;} |
| A. | There should be a condition in the while loop. |
| B. | There should be at least a semicolon in the while( ). |
| C. | The while loop should be replaced by a for loop. |
| D. | No error |
| Answer» B. There should be at least a semicolon in the while( ). | |
| 44. |
Which of then following is the correct output for the program given below?#include <stdio.h>int main(){int k = 5;while ( k++ != 5) printf ("%d", ++k);printf (" n");return 0;} |
| A. | 5 6 7 ........ 127 0 1 2 3 4 |
| B. | 5 6 7.........65535 0 1 2 3 4 |
| C. | 5 6 ...........32767 -32766 -32765 ...... 3 4 |
| D. | No output |
| Answer» E. | |
| 45. |
Which of the following statement are correct about the program given below?#include <stdio.h>int main ( ){ char ch; while (ch = 0; ch <= 255; ch++) printf ("ASCII value %d Character %c n", ch, ch); return 0;} |
| A. | The program goes in an infinite loop. |
| B. | The program prints all the ASCII values with its corresponding characters. |
| C. | Error: ch should be declared as an int. |
| D. | The program reports an error as while loop cannot take the form of a for loop. |
| Answer» E. | |
| 46. |
Which of the following is the correct output for the program given below?#include <stdio.h>int main ( ){ int a = 0; for (; a < 5 ; a++); printf ("%d n", a); return 0;} |
| A. | 0 1 2 3 4 |
| B. | 5 |
| C. | 1 2 3 4 |
| D. | 6 |
| Answer» C. 1 2 3 4 | |
| 47. |
On executing the following program how many times will the message "Thanks God" get printed?#include <stdio.h>int main ( ) { int a; for(a = -1; a <= 10; a++) { if (a < 5) continue; else break; printf(" Thanks God n"); }return 0;} |
| A. | Infinite times |
| B. | 11 times |
| C. | 0 times |
| D. | Once |
| E. | 10 times |
| Answer» D. Once | |
| 48. |
How many times the while loop in the following program will get executed if a short int is 2 byte wide?#include <stdio.h>int main ( ){ int a = 1; while (a <= 255) { printf ("%c %d n", a, a); a++; } return 0;} |
| A. | Infinite times |
| B. | 255 times |
| C. | 256 times |
| D. | Only once |
| E. | 254 times |
| Answer» C. 256 times | |
| 49. |
In the program given below, point out the error, if any, in the for loop.#include <studio.h>int main(){ int i = 1; for (;;) { printf("%d n", i++); if (i > 10) break; } return 0;} |
| A. | There should be a condition in the for loop. |
| B. | The two semicolons should be dropped. |
| C. | The for loop should be replaced by a while loop. |
| D. | No error |
| Answer» E. | |
| 50. |
Which of the following is the correct output for the program given below ? #include <studio.h>int main(){char i = 0;for (i<=5 && i>= -1; ++i; i>0)printf ("%d n",i);printf ("% n");return 0;} |
| A. | 1 2 3 ..... 126 127 -128 - 127 .... -2 -1 |
| B. | Expression syntax error |
| C. | No Output |
| D. | 0 1 2 3 4 5 |
| Answer» B. Expression syntax error | |