

MCQOPTIONS
Saved Bookmarks
This section includes 14 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> void main() { int const m = 10; m++; printf("m is %d", m); } |
A. | 10 |
B. | 11 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» E. None of these | |
2. |
What will be the output of the following C code?#include <stdio.h> int const Result() { printf("interviewmania.com"); return 0; } void main() { Result(); } |
A. | interviewmania.com is printed infinite times |
B. | interviewmania.com |
C. | Runtime Error |
D. | Error because function name cannot be preceded by const |
E. | None of these |
Answer» C. Runtime Error | |
3. |
What will be the output of the following program:- #include int main() { const int a=34; int b=128; a = b; printf("%d n",a); return 0; } |
A. | 128 |
B. | 34 |
C. | Compiler error |
D. | garbage value |
Answer» D. garbage value | |
4. |
What will be the output of the following C code?#include <stdio.h> void main() { int n = 21; int *const m = &n; int s = 12; m = &s; printf("%d", m); } |
A. | 21 |
B. | Compilation Error |
C. | 12 |
D. | Runtime Error |
E. | None of these |
Answer» C. 12 | |
5. |
What will be the output of the following C code?#include <stdio.h> int main() { const int n; n = 12; printf("n is %d", n); return 0; } |
A. | Compilation Error |
B. | n is 4 |
C. | Runtime Error |
D. | Garbage value |
E. | None of these |
Answer» B. n is 4 | |
6. |
What will be the output of the following C code?#include <stdio.h> #define MAX 3 enum car {AstonMartin = MAX + 1, Audi = AstonMartin + MAX}; int main() { enum car c = Audi; printf("%d n", c); return 0; } |
A. | 3 |
B. | Compilation Error |
C. | 7 |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
7. |
What will be the output of the following C function?#include <stdio.h> enum car {AstonMartin, Audi, Chevrolet, Ferrari}; enum color {Yellow = 5, Green, RedBlue, Blue}; int main() { enum car c = Yellow; int i; i = c; printf("%d n", i); return 0; } |
A. | Compilation Error |
B. | Yellow |
C. | AstonMartin |
D. | 5 |
E. | Runtime Error |
Answer» E. Runtime Error | |
8. |
What will be the output of the following C code? #include <stdio.h> int main() { int n = 020; printf("%d", n); } |
A. | 2 |
B. | 4 |
C. | 8 |
D. | 16 |
E. | None of these |
Answer» E. None of these | |
9. |
What will be the output of the following C code?#include <stdio.h> #define num 12 int main() { const int num = 10; printf("num = %d n", num); } |
A. | num |
B. | num = 12 |
C. | num = 10 |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
10. |
In the following code snippet, character pointer str holds a reference to the string ___________.char *s = "interviewmania.com 0" "c programming"; |
A. | interviewmania.comc programming |
B. | interviewmania.com |
C. | c programming 0c programming |
D. | c programming |
E. | None of these |
Answer» D. c programming | |
11. |
What will be the output of the following C code? #include <stdio.h> int main() { enum {Blue = 4, Green, Yellow = 5, Red}; printf("Red = %d n", Red); } |
A. | Red = 4 |
B. | Red = 5 |
C. | Red = 6 |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
12. |
Which of the following is the correct output for the program given below?#include<stdio.h>int main(){ const int k = 10; printf("%d n", k++); return 0;} |
A. | 10 |
B. | 1 1 |
C. | No output |
D. | Error: ++ needs a l value |
Answer» E. | |
13. |
com |
A. | Sanfoundry.com\0training classes |
B. | Sanfoundry.comtraining classes |
C. | Invalid declaration |
Answer» C. Invalid declaration | |
14. |
PEACH = 3 |
A. | PEACH = 4 |
B. | PEACH = 5 |
C. | PEACH = 6 |
Answer» D. | |