100 Multiple Choice Questions In C Programming – Part 14
This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
1. What is the output of the following C program?
#include <stdio.h> int main() { int x = 010; printf("%d", x); }
A 2
B 8
C 9
D 10
2. What is the output of the following C program?
#include <stdio.h> enum bird {SPARROW, CANARY, Hen}; enum animal {LION = 16, RABBIT, ZEBRA, TIGER}; int main() { enum bird b = LION; int k; k = b; printf("%d\n", k); return 0; }
A 0
B Compilation error
C 1
D 16
[st_adsense]
3. What is the output of the following C program?
#include <stdio.h> #define MAX 3 enum animal {LION = MAX + 1, RABBIT = LION + MAX}; int main() { enum animal a = RABBIT; printf("%d\n", a); return 0; }
A Compilation error
B 7
C Undefined value
D 3
4. What is the output of the following C program?
#include <stdio.h> #include <string.h> int main() { char *str = "y"; char c = 'y'; char array[1]; array[0] = c; printf("%d %d", strlen(str), strlen(array)); return 0; }
A 1 1
B 2 1
C 2 2
D 1 (undefined value)
5. Enumeration types are handled by ____?
A Compiler
B Preprocessor
C Linker
D Assembler
[st_adsense]
6. What is the output of the following C program?
#include <stdio.h> int main() { printf("Hello\rworld!\n"); return 0; }
A Hello\rworld!
B Helloworld!\n
C world!
D world!Hello
7. What is the output of the following C program?
#include <stdio.h> int main() { printf("Hello\r\nworld!\n"); return 0; }
A Hello\rworld!
B Hello
world!
C world!
D world!Hello
8. What is the output of the following C program?
#include <stdio.h> int const display() { printf("Hello world!"); return 0; } void main() { display(); }
A Error because the function name cannot be preceded by const
B Hello world!
C Hello world! is displayed in infinity
D No output
[st_adsense]
9. What is the output of the following C program?
#include <stdio.h> int main() { int const q = 7; q++; printf("q = %d", q); }
A q = 8
B Error due to int followed by const
C Error, because a constant variable can only be modified twice
D Error, because a constant variable cannot be modified
10. What is the output of the following C program?
#include <stdio.h> int main() { int q = 8; int *const p = &q; int a = 6; p = &a; printf("%d", p); }
A Address of q
B Address of a
C Compilation error
D Address of q plus address of a