

MCQOPTIONS
Saved Bookmarks
This section includes 46 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. |
Which of the following is the correct output for the program given below?
#define SQR(k) (k * k) int main( ) { int p, q = 5 ; p = SQR (q + 3) ; printf ("%d n" , p) ; return 0 ; } |
A. | 64 |
B. | 23 |
C. | Error |
D. | Garbage value |
Answer» C. Error | |
2. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Summer |
C. | Winter |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
3. |
What will be the output of the following C code?
|
A. | MAXIMUM |
B. | MINIMUM |
C. | 20 |
D. | 100 |
E. | 100 20 |
Answer» F. | |
4. |
What will be the output of the following C code?
|
A. | 21 210 |
B. | 210 21 |
C. | Compilation Error |
D. | Garbage value |
E. | None of these |
Answer» C. Compilation Error | |
5. |
What will be the output of the following C code?
|
A. | Preprocessor error |
B. | Garbage value |
C. | Compilation Error |
D. | 250 30 |
E. | None of these |
Answer» D. 250 30 | |
6. |
What will be the output of the following C code?
|
A. | 15 115 |
B. | 115 15 |
C. | Garbage value |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
7. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Compilation Error |
C. | 25 125 |
D. | 125 25 |
E. | None of these |
Answer» E. None of these | |
8. |
What will be the output of the following C code?
|
A. | 10 |
B. | 110 |
C. | 10 110 |
D. | 110 10 |
E. | Compilation Error |
Answer» E. Compilation Error | |
9. |
What will be the output of the following C code?
|
A. | Compilation error as lvalue is required for the expression p*q=101 |
B. | Interview Mania |
C. | Preprocessor error as lvalue is required for the expression p*q=101 |
D. | Runtime error as lvalue is required for the expression p*q=101 |
E. | None of these |
Answer» C. Preprocessor error as lvalue is required for the expression p*q=101 | |
10. |
What will be the output of the following C code?
|
A. | -10 |
B. | -14 |
C. | 5 |
D. | Compilation Error |
E. | None of these |
Answer» C. 5 | |
11. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | pq |
C. | ab |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
12. |
What will be the output of the following C code?
|
A. | a ## b |
B. | p ## q |
C. | Compilation Error |
D. | Nothing |
E. | None of these |
Answer» C. Compilation Error | |
13. |
What will be the output of the following C code?
|
A. | p q |
B. | a b |
C. | Undefined behaviour |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
14. |
What will be the output of the following C code?
|
A. | 21 |
B. | Garbage value |
C. | 11 |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
15. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | -17 12 |
C. | -21 -5 |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
16. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Depends on compiler |
C. | Welcome |
D. | Varies |
E. | None of these |
Answer» B. Depends on compiler | |
17. |
The below two lines are equivalent to ________.
|
A. | #include<stdio.h> |
B. | #include C_IO_HEADER |
C. | #include printf |
D. | #include<stdlib.h> |
E. | None of these |
Answer» B. #include C_IO_HEADER | |
18. |
What will be the output of the following C code snippet?
|
A. | Depends on compiler |
B. | Compilation Error |
C. | Welcome |
D. | Nothing |
E. | None of these |
Answer» C. Welcome | |
19. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Welcome |
C. | Compilation Error |
D. | Nothing |
E. | None of these |
Answer» C. Compilation Error | |
20. |
What will be the output of the following C code?
|
A. | 23 |
B. | Garbage value |
C. | 55 |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
21. |
What will be the output of the following C code?
|
A. | Interview |
B. | Interview Mania |
C. | Mania |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
22. |
What is the output of this C code?
|
A. | Divided by zero exception |
B. | -14 divided by zero exception |
C. | -14 -18 |
D. | -18 -14 |
E. | None of these |
Answer» E. None of these | |
23. |
What will be the output of the following C code?
|
A. | 15 |
B. | Compilation Error |
C. | Garbage value |
D. | 225 |
E. | None of these |
Answer» E. None of these | |
24. |
What will be the output of the following C code?
|
A. | -11 |
B. | -10 |
C. | Runtime Error |
D. | Compilation Error |
E. | None of these |
Answer» B. -10 | |
25. |
What will be the output of the following C code?
|
A. | 5,3 |
B. | 4,6 |
C. | Compilation Error |
D. | 23 |
E. | None of these |
Answer» E. None of these | |
26. |
Comment on the output of the following C code.
|
A. | Garbage value |
B. | Compile time error, there are no open braces in #define |
C. | 200 |
D. | Compile time error, the printf braces aren t closed |
E. | None of these |
Answer» D. Compile time error, the printf braces aren t closed | |
27. |
What will be the output of the following C code?
|
A. | const |
B. | Compilation Error |
C. | 41 |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
28. |
What will be the output of the following C code?
|
A. | Depends on compiler |
B. | 85 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» C. Compilation Error | |
29. |
What will be the output of the following C code?
|
A. | Depends on compiler |
B. | 56 |
C. | Runtime Error |
D. | Nothing |
E. | Compilation Error |
Answer» F. | |
30. |
What will be the output of the following C code?
|
A. | 10 |
B. | 15 |
C. | 1510 |
D. | 1015 |
E. | None of these |
Answer» E. None of these | |
31. |
What will be the output of the following C code?
|
A. | 4 |
B. | 5 |
C. | 4, 5 |
D. | 5, 4 |
E. | None of these |
Answer» D. 5, 4 | |
32. |
Comment on the output of the following C code.
|
A. | False |
B. | True |
C. | Depends on compiler |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
33. |
The #else directive is used for _________. |
A. | Ending conditional text |
B. | Conditionally include source text if a macro name is defined |
C. | Conditionally include source text if the previous #if, #ifdef, #ifndef, or #elif test fails |
D. | Conditionally include source text if a macro name is not defined |
E. | None of these |
Answer» D. Conditionally include source text if a macro name is not defined | |
34. |
Conditional inclusion can be used for ___________. |
A. | Check for existence of a variable and doing something if it exists |
B. | Preventing multiple declarations of same function |
C. | Preventing multiple declarations of a variable |
D. | All of above |
E. | None of these |
Answer» E. None of these | |
35. |
Which of the following sequences are unaccepted in C language? |
A. | <pre class="prettyprint lang-c">#if<br> #undef<br> #endif<br></pre> |
B. | <pre class="prettyprint lang-c">#if<br> #else<br> #endif<br></pre> |
C. | <pre class="prettyprint lang-c">#if<br> #elif<br> #endif<br></pre> |
D. | <pre class="prettyprint lang-c"> #if<br> #if<br> #endif<br></pre> |
E. | None of these |
Answer» E. None of these | |
36. |
The else if in conditional inclusion is written by? |
A. | #elif |
B. | #elsif |
C. | #elseif |
D. | #else if |
E. | None of these |
Answer» B. #elsif | |
37. |
#include statement must be written __________. |
A. | It can be written anywhere |
B. | After main() |
C. | Before main() |
D. | Before any scanf/printf |
E. | None of these |
Answer» E. None of these | |
38. |
#include
|
A. | Library, user-created header |
B. | User-created header, library |
C. | They can include all types of file |
D. | Library, Library |
E. | None of these |
Answer» D. Library, Library | |
39. |
The preprocessor provides the ability for _______________. |
A. | Conditional compilation and line control |
B. | The inclusion of macro expansions |
C. | The inclusion of header files |
D. | All of above |
E. | None of these |
Answer» E. None of these | |
40. |
If the file name is enclosed in double quotation marks, then _________. |
A. | The preprocessor treats it as a system-defined file |
B. | The preprocessor treats it as a user-defined file & system-defined file |
C. | The preprocessor treats it as a user-defined file |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
41. |
How is search done in #include and #include somelibrary.h normally or conventionally? |
A. | For both, search for somelibrary is done in implementation-defined manner |
B. | When former is used, search is done in implementation defined manner and latter is used to search current directory |
C. | When former is used, predefined directory is searched and when latter is used, current directory is searched and then predefined directories are searched |
D. | When former is used, current directory is searched and when latter is used, standard directory is searched |
E. | NA |
Answer» D. When former is used, current directory is searched and when latter is used, standard directory is searched | |
42. |
The below two lines are equivalent to ________. |
A. | #include<stdio.h> |
B. | #include C_IO_HEADER |
C. | #include printf |
D. | #include<stdlib.h> |
E. | None of these |
Answer» B. #include C_IO_HEADER | |
43. |
What will be the output of the following C code snippet? |
A. | Depends on compiler |
B. | Compilation Error |
C. | Welcome |
D. | Nothing |
E. | None of these |
Answer» C. Welcome | |
44. |
If the file name is enclosed in angle brackets, then ___________. |
A. | The preprocessor treats it as a user-defined file & system-defined file |
B. | The preprocessor treats it as a user-defined file |
C. | The preprocessor treats it as a system-defined file |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
45. |
How is search done in #include and #include somelibrary.h according to C standard? |
A. | For both, search for somelibrary is done in implementation-defined places |
B. | When former is used, search is done in implementation defined manner and when latter is used, current directory is searched |
C. | When former is used, standard directory is searched and when latter is used, current directory is searched |
D. | When former is used, current directory is searched and when latter is used, standard directory is searched |
E. | None of these |
Answer» C. When former is used, standard directory is searched and when latter is used, current directory is searched | |
46. |
What would happen if you create a file stdio.h and use #include stdio.h ? |
A. | The compiler won t accept the program |
B. | Both the files will be included |
C. | The predefined library file will be selected |
D. | The user-defined library file will be selected |
E. | None of these |
Answer» E. None of these | |