MCQOPTIONS
 Saved Bookmarks
				This section includes 104 Mcqs, each offering curated multiple-choice questions to sharpen your C Preprocessor knowledge and support exam preparation. Choose a topic below to get started.
| 1. | 
                                    What is the output of the following C program? #include #define SQR(x) (x*x) int main() { int a; int b=4; a=SQR(b+2); printf("%dn",a); return 0; } | 
                            
| A. | 14 | 
| B. | 36 | 
| C. | 18 | 
| D. | 20 | 
| Answer» B. 36 | |
| 2. | 
                                    How will you free the memory allocated by the following program? #include #define CONDITION(x) printf("letsfindcourse"); int main() { CONDITION(0); return 0; } | 
                            
| A. | Runtime Error | 
| B. | letsfindcourse | 
| C. | Compilation error | 
| D. | None of the above | 
| Answer» C. Compilation error | |
| 3. | 
                                    The translator which performs macro calls expansion is called: | 
                            
| A. | Macro processor | 
| B. | Micro pre - processor | 
| C. | Macro pre - processor | 
| D. | Dynamic Linker | 
| Answer» D. Dynamic Linker | |
| 4. | 
                                    What is the Error of this program? #include #define CONDITION(x) printf("letsfindcourse"); int main() { CONDITION(0); return 0; } | 
                            
| A. | letsfindcourse | 
| B. | Compilation error | 
| C. | Runtime error | 
| D. | None of the above | 
| Answer» C. Runtime error | |
| 5. | 
                                    Which statment is true about the given code ? #include enum colors {lets,find,course}; int main() { printf("%d %d %d",course,lets,find); return 0; } | 
                            
| A. | 3 1 2 | 
| B. | 0 1 2 | 
| C. | 2 0 1 | 
| D. | 1 0 2 | 
| Answer» D. 1 0 2 | |
| 6. | 
                                    What is the output of this program? #include int main() { printf("%d",30); return 0; } | 
                            
| A. | Runtime Error | 
| B. | Garbage value | 
| C. | Compilation error | 
| D. | 30 | 
| Answer» D. 30 | |
| 7. | 
                                    What is the output of this program? #include #define p 17; int main() { printf("%d",p); return 0; } | 
                            
| A. | Garbage value | 
| B. | Runtime error | 
| C. | 17 | 
| D. | Compilation error | 
| Answer» E. | |
| 8. | 
                                    What is the output of this program? #include #define clrscr() 17 int main() { clrscr(); printf("%d",clrscr()); return 0; } | 
                            
| A. | Compilation error | 
| B. | Runtime error | 
| C. | 17 | 
| D. | none of the above | 
| Answer» D. none of the above | |
| 9. | 
                                    What is the output for the following code snippet? #include #define A -B #define B -C #define C 5 int main() { printf("The value of A is %dn", A); return 0; } | 
                            
| A. | The value of A is 4 | 
| B. | The value of A is 5 | 
| C. | Compilation Error | 
| D. | Runtime Error | 
| Answer» C. Compilation Error | |
| 10. | 
                                    What is the output of this program? #include #define i 5 int main() { #define i 10 printf("%d",i); return 0; } | 
                            
| A. | Compilation error | 
| B. | 10 | 
| C. | 5 | 
| D. | Runtime error | 
| Answer» C. 5 | |
| 11. | 
                                    Consider the following statements #define hypotenuse (a, b) sqrt (a*a+b*b); The macro call hypotenuse(a+2,b+3); | 
                            
| A. | Finds the hypotenuse of a triangle with sides a+2 and b+3 | 
| B. | Finds the square root of (a+2) and (b+3) | 
| C. | Is invalid | 
| D. | Find the square root of 3*a + 4*b + 5 | 
| Answer» E. | |
| 12. | 
                                    The following program won t compile because there re space between macro name and open parenthesis. #include "stdio.h" #define MYINC ( a ) ( ( a ) + 1 ) int main() { printf("GeeksQuiz!"); return 0; } | 
                            
| A. | TRUE | 
| B. | FALSE | 
| Answer» C. | |
| 13. | 
                                    Output of following C program? #include #define max abc #define abc 100 int main() { printf("maximum is %d", max); return 0; } | 
                            
| A. | maximum is 100 | 
| B. | abcimum is 100 | 
| C. | 100imum is 100 | 
| D. | abcimum is abc | 
| Answer» B. abcimum is 100 | |
| 14. | 
                                    #include #define get(s) #s int main() { char str[] = get(GeeksQuiz); printf("%s", str); return 0; } | 
                            
| A. | Compiler Error | 
| B. | #GeeksQuiz | 
| C. | GeeksQuiz | 
| D. | GGeeksQuiz | 
| Answer» D. GGeeksQuiz | |
| 15. | 
                                    Predict the output of following program? #include #define MAX 1000 int main() { int MAX = 100; printf("%d ", MAX); return 0; } | 
                            
| A. | 1000 | 
| B. | 100 | 
| C. | Compiler Error | 
| D. | Garbage Value | 
| Answer» D. Garbage Value | |
| 16. | 
                                    What is the output of this program? #include #define x 3 int main() { int i; i = x*x*x; printf("%d",i); return 0; } | 
                            
| A. | 27 | 
| B. | x is not declared | 
| C. | No output | 
| D. | Garbage value | 
| Answer» B. x is not declared | |
| 17. | 
                                    What is the output of this program? #include #include #define square(x) x*x int main() { int i; i = 27/square(3); printf("%d",i); return 0; } | 
                            
| A. | 9 | 
| B. | Compilation error | 
| C. | 3 | 
| D. | 27 | 
| Answer» E. | |
| 18. | 
                                    What is the use of "#pragma once"? | 
                            
| A. | Used in a header file to avoid its inclusion more than once | 
| B. | Used to avoid multiple declarations of same variable | 
| C. | Used in a c file to include a header file at least once | 
| D. | Used to avoid assertions | 
| Answer» B. Used to avoid multiple declarations of same variable | |
| 19. | 
                                    What is the output of this program? #include #define int char main() { int i=50; printf ("sizeof (i) =%d", sizeof (i)); } | 
                            
| A. | 2 | 
| B. | 4 | 
| C. | 8 | 
| D. | 1 | 
| Answer» E. | |
| 20. | 
                                    Output? #include #define f(g,g2) g##g2 int main() { int var12 = 100; printf("%d", f(var,12)); return 0; } | 
                            
| A. | 100 | 
| B. | Compiler Error | 
| C. | 1 | 
| Answer» B. Compiler Error | |
| 21. | 
                                    Which file is generated after pre-processing of a C program? | 
                            
| A. | .p | 
| B. | .i | 
| C. | .o | 
| D. | .m | 
| Answer» C. .o | |
| 22. | 
                                    #include #define a 10 int main() { printf("%d ",a); #define a 50 printf("%d ",a); return 0; } | 
                            
| A. | Compiler Error | 
| B. | 10 50 | 
| C. | 50 50 | 
| D. | 10 10 | 
| Answer» C. 50 50 | |
| 23. | 
                                    #include #define square(x) x*x int main() { int x; x = 36/square(6); printf("%d", x); return 0; } | 
                            
| A. | 1 | 
| B. | 36 | 
| C. | Compiler Error | 
| Answer» C. Compiler Error | |
| 24. | 
                                    # include # define scanf "%s Geeks Quiz " int main() { printf(scanf, scanf); return 0; } | 
                            
| A. | Compiler Error | 
| B. | %s Geeks Quiz | 
| C. | Geeks Quiz | 
| D. | %s Geeks Quiz Geeks Quiz | 
| Answer» E. | |
| 25. | 
                                    #include #define ISEQUAL(X, Y) X == Y int main() { #if ISEQUAL(X, 0) printf("Geeks"); #else printf("Quiz"); #endif return 0; } Output of the above program? | 
                            
| A. | Geeks | 
| B. | Quiz | 
| C. | Any of Geeks or Quiz | 
| D. | Compile time error | 
| Answer» B. Quiz | |
| 26. | 
                                    #include #define X 3 #if !X printf("Geeks"); #else printf("Quiz"); #endif int main() { return 0; } | 
                            
| A. | Geeks | 
| B. | Quiz | 
| C. | Compiler Error | 
| D. | Runtime Error | 
| Answer» D. Runtime Error | |
| 27. | 
                                    What is the output of following program? #include #define macro(n, a, i, m) m##a##i##n #define MAIN macro(n, a, i, m) int MAIN() { printf("GeeksQuiz"); return 0; } | 
                            
| A. | Compiler Error | 
| B. | GeeksQuiz | 
| C. | MAIN | 
| D. | main | 
| Answer» C. MAIN | |
| 28. | 
                                    #include #if X == 3 #define Y 3 #else #define Y 5 #endif int main() { printf("%d", Y); return 0; } What is the output of the above program? | 
                            
| A. | 3 | 
| B. | 5 | 
| C. | 3 or 5 depending on value of X | 
| D. | Compile time error | 
| Answer» C. 3 or 5 depending on value of X | |
| 29. | 
                                    Which of the following are correctly formed #define statements in C? | 
                            
| A. | #define CUBE (X) (X*X*X); | 
| B. | #define CUBE(x) (X*X*X) | 
| C. | #define CUBE(X)(X*X*X) | 
| D. | #define CUBE(X) {X*X*X} | 
| Answer» D. #define CUBE(X) {X*X*X} | |
| 30. | 
                                    Preprocessor directive #undef can be used only on a macro that has been #define earlier | 
                            
| A. | True | 
| B. | False | 
| Answer» B. False | |
| 31. | 
                                    Which of the following are correct preprocessor directives in C? 1. #ifdef 2. #if 3. #elif 4. #undef | 
                            
| A. | 1, 2 | 
| B. | 4 | 
| C. | |
| D. | D. | 
| Answer» E. | |
| 32. | 
                                    Point out the error in the program #include int main() { int i; #if A printf("Enter any number:"); scanf("%d", &i); #elif B printf("The number is odd"); return 0; } | 
                            
| A. | Error: unexpected end of file because there is no matching #endif | 
| B. | The number is odd | 
| C. | Garbage values | 
| D. | None of above | 
| Answer» B. The number is odd | |
| 33. | 
                                    Point out the error in the program #include #define SI(p, n, r) float si; si=p*n*r/100; int main() { float p=2500, r=3.5; int n=3; SI(p, n, r); SI(1500, 2, 2.5); return 0; } | 
                            
| A. | 26250.00 7500.00 | 
| B. | Nothing will print | 
| C. | Error: Multiple declaration of si | 
| D. | Garbage values | 
| Answer» D. Garbage values | |
| 34. | 
                                    The NULL character indicates an end of a string and a file. | 
                            
| A. | TRUE | 
| B. | May Be | 
| C. | FALSE | 
| D. | Can't Say | 
| Answer» C. FALSE | |
| 35. | 
                                    Nested macros are allowed. | 
                            
| A. | TRUE | 
| B. | May Be | 
| C. | FALSE | 
| D. | Can't Say | 
| Answer» C. FALSE | |
| 36. | 
                                    In a program the statement: #include "filename" is replaced by the contents of the file "filename"? | 
                            
| A. | Before compilation | 
| B. | During execution | 
| C. | After Compilation | 
| D. | None of the above | 
| Answer» B. During execution | |
| 37. | 
                                    Tn a macro call the control is passed to the macro. | 
                            
| A. | TRUE | 
| B. | FALSE | 
| C. | May Be | 
| D. | Can't Say | 
| Answer» C. May Be | |
| 38. | 
                                    All macro substitutions in a program are done? | 
                            
| A. | Before compilation of the program | 
| B. | During execution | 
| C. | After compilation | 
| D. | None of the above | 
| Answer» B. During execution | |
| 39. | 
                                    The EOF character can be included in a file as part of its data | 
                            
| A. | TRUE | 
| B. | May Be | 
| C. | FALSE | 
| D. | Can't Say | 
| Answer» C. FALSE | |
| 40. | 
                                    What will be the output of the following C code if the value of p is 10 and that of q is 15? #include int main() { int p,q; printf("Enter two numbers n"); scanf("%d",&p); scanf("%d",&q); #if(4<2>-1) printf("%d",q); #else printf("bye"); #endif } | 
                            
| A. | 10 | 
| B. | 15 | 
| C. | bye | 
| D. | error | 
| Answer» C. bye | |
| 41. | 
                                    Identify the stringizing operator. | 
                            
| A. | + | 
| B. | :: | 
| C. | # | 
| D. | ## | 
| Answer» D. ## | |
| 42. | 
                                    Undefined function calls in a C program. | 
                            
| A. | by the preprocessor | 
| B. | by the linker | 
| C. | by the assembler | 
| D. | by the operating system are detected | 
| Answer» D. by the operating system are detected | |
| 43. | 
                                    va_list is | 
                            
| A. | a macro defined in stdarg.h | 
| B. | a predefined data type in stdarg.h | 
| C. | a macro defined in stdlib.h | 
| D. | a predefined data type stdlib.h. | 
| Answer» C. a macro defined in stdlib.h | |
| 44. | 
                                    Identify the trigraph sequence for^. | 
                            
| A. | ??/ | 
| B. | ??= | 
| C. | ?? | 
| D. | ??! | 
| Answer» D. ??! | |
| 45. | 
                                    The following line in a program # represents | 
                            
| A. | an invalid code | 
| B. | a null directive | 
| C. | a comment | 
| D. | a page number | 
| Answer» C. a comment | |
| 46. | 
                                    Identify the macro(s) defined in stdarg.h. | 
                            
| A. | va_start | 
| B. | va_end | 
| C. | va_arg | 
| D. | all the above | 
| Answer» E. | |
| 47. | 
                                    What is the output generated by the following code? #define square (a) (a*a) printf("%d", square (4+5) ) ; | 
                            
| A. | 81 | 
| B. | 4 | 
| C. | 29 | 
| D. | None of the above. | 
| Answer» D. None of the above. | |
| 48. | 
                                    Identify the trigraph sequence for . | 
                            
| A. | ??/ | 
| B. | ??= | 
| C. | ?? | 
| D. | ??! | 
| Answer» B. ??= | |
| 49. | 
                                    A macro must always be written in capital letters. | 
                            
| A. | TRUE | 
| B. | May Be | 
| C. | FALSE | 
| D. | Can't Say | 
| Answer» C. FALSE | |
| 50. | 
                                    A macro should always be accommodated in a single line. | 
                            
| A. | TRUE | 
| B. | May Be | 
| C. | FALSE | 
| D. | Can't Say | 
| Answer» B. May Be | |