C Programming MCQ
C Programming MCQ
9. Which keyword is used to prevent any changes in the variable within a C program?
a) immutable
b) mutable
c) const
d) volatile
18. Property which allows to produce different executable for different platforms in C is
called?
a) File inclusion
b) Selective inclusion
c) Conditional compilation
d) Recursive macros
23. How is search done in #include and #include “somelibrary.h” according to C standard?
a) When former is used, current directory is searched and when latter is used, standard
directory is searched
b) When former is used, standard directory is searched and when latter is used, current
directory is searched
c) When former is used, search is done in implementation defined manner and when latter
is used, current directory is searched
d) For both, search for ‘somelibrary’ is done in implementation-defined places
24. How many number of pointer (*) does C have against a pointer variable declaration?
a) 7
b) 127
c) 255
d) No limits
27. The standard header _______ is used for variable list arguments (…) in C.
a) <stdio.h >
b) <stdlib.h>
c) <math.h>
d) <stdarg.h>
28. When a C program is started, O.S environment is responsible for opening file and
providing pointer for that file?
a) Standard input
b) Standard output
c) Standard error
d) All of the mentioned
fp = fopen("Random.txt", "a");
a) Attach
b) Append
c) Apprehend
d) Add
1. #include <stdio.h>
2. int main()
3. {
4. int y = 10000;
5. int y = 34;
6. printf("Hello World! %d\n", y);
7. return 0;
8. }
1. #include <stdio.h>
2. int main()
3. {
4. int main = 3;
5. printf("%d", main);
6. return 0;
7. }
1. #include <stdio.h>
2. int main()
3. {
4. signed char chr;
5. chr = 128;
6. printf("%d\n", chr);
7. return 0;
8. }
a) 128
b) -128
c) Depends on the compiler
d) None of the mentioned
37. What will be the output of the following C code on a 64 bit machine?
1. #include <stdio.h>
2. union Sti
3. {
4. int nu;
5. char m;
6. };
7. int main()
8. {
9. union Sti s;
10. printf("%d", sizeof(s));
11. return 0;
12. }
a) 8
b) 5
c) 9
d) 4
1. #include <stdio.h>
2. enum birds {SPARROW, PEACOCK, PARROT};
3. enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
4. int main()
5. {
6. enum birds m = TIGER;
7. int k;
8. k = m;
9. printf("%d\n", k);
10. return 0;
11. }
a) 0
b) Compile time error
c) 1
d) 8
1. #include <stdio.h>
2. int main()
3. {
4. for (int k = 0; k < 10; k++);
5. return 0;
6. }
a) Yes
b) No
c) Depends on the C standard implemented by compilers
d) Error