

MCQOPTIONS
Saved Bookmarks
This section includes 98 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 would be the output of following program ?
|
A. | Error |
B. | 15 |
C. | 60 |
D. | Garbage value |
Answer» D. Garbage value | |
2. |
Which of the following is the correct output for the program given below?
|
A. | 2 |
B. | 4 |
C. | Would vary from compiler to compiler |
D. | Error, x undefined |
Answer» E. | |
3. |
Which of the following is the correct output for the program given below?
|
A. | 30 |
B. | 0 |
C. | Garbage value |
D. | Error |
Answer» B. 0 | |
4. |
Which of the following is the correct output for the program given below ?
|
A. | 3 |
B. | 5.74 |
C. | 0 |
D. | Error |
Answer» E. | |
5. |
What will be the output of the following C code?
|
A. | 12 21 |
B. | 21 12 |
C. | Runtime Error |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
6. |
What will be the output of the following C code?
|
A. | 18 |
B. | Compilation Error |
C. | 15 |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
7. |
Will the following C code compile without any error?
|
A. | No |
B. | Yes |
C. | Depends on the C standard implemented by compilers |
D. | All of above |
E. | None of these |
Answer» C. Depends on the C standard implemented by compilers | |
8. |
What will be the output of the following C code?
|
A. | 21 |
B. | 22 |
C. | 23 |
D. | 24 |
E. | Compilation Error |
Answer» F. | |
9. |
What will be the output of the following C code?
|
A. | 11 |
B. | Compilation Error |
C. | 22 |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
10. |
What will be the output of the following C code?
|
A. | 12 |
B. | Compilation Error |
C. | 12.000000 |
D. | Runtime Error |
E. | None of these |
Answer» C. 12.000000 | |
11. |
Will the following C code compile without any error?
|
A. | No |
B. | Yes |
C. | Garbage value |
D. | Depends on the C standard implemented by compilers |
E. | None of these |
Answer» E. None of these | |
12. |
Which of the following format identifier can never be used for the variable var?
|
A. | %s |
B. | %c |
C. | %d |
D. | %f |
E. | None of these |
Answer» E. None of these | |
13. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 0 |
C. | Runtime Error |
D. | Garbage value |
E. | None of these |
Answer» C. Runtime Error | |
14. |
What will be the output of the following C code?
|
A. | 10 |
B. | 0 |
C. | Compilation Error |
D. | Depend on compiler |
E. | None of these |
Answer» D. Depend on compiler | |
15. |
Which part of the program address space is p stored in the following C code?
|
A. | Data segment |
B. | Code/text segment |
C. | Stack |
D. | Bss segment |
Answer» E. | |
16. |
What will be the output of the following C code?
|
A. | 5 |
B. | Infinite calls to main |
C. | Runtime Error |
D. | Varies |
E. | main is called twice |
Answer» F. | |
17. |
What is the problem in following variable declaration?
|
A. | The special character - |
B. | The special character ? |
C. | The variable name begins with an integer |
D. | All of above |
E. | None of these |
Answer» E. None of these | |
18. |
What will happen if the following C code is executed?
|
A. | 10 |
B. | 12 |
C. | 15 |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
19. |
What is the output of this C code?
|
A. | My Name is - myName; |
B. | My Name is - followed by a junk value |
C. | Compile time error |
D. | My Name is - |
Answer» D. My Name is - | |
20. |
Which of the following is an external variable in the following C code?
|
A. | p |
B. | q |
C. | r |
D. | s |
E. | None of these |
Answer» E. None of these | |
21. |
What will be the output of the following C code?
|
A. | 15 5 |
B. | 5 15 |
C. | 10 5 |
D. | 5 10 |
E. | 5 5 |
Answer» F. | |
22. |
What will be the output of the following C code?
|
A. | 10 5 |
B. | 5 10 |
C. | 6 5 |
D. | 5 6 |
E. | None of these |
Answer» E. None of these | |
23. |
Which part of the program address space is ptr stored in the following C code?
|
A. | 0 |
B. | Code/text segment |
C. | Data segment |
D. | Bss segment |
E. | Stack |
Answer» D. Bss segment | |
24. |
What will be the output of the following C code (after linking to source file having definition of arrayA)?
|
A. | Compile time error due to multiple definitio |
B. | Compile time error because size of array is not provided |
C. | Compile time error because datatype of array is not provided |
D. | Value of arrayA[0]; |
E. | None of these |
Answer» D. Value of arrayA[0]; | |
25. |
What will be the output of the following C code (without linking the source file in which arrayA is defined)?
|
A. | Linking error due to undefined reference |
B. | Compile time error because datatype of array is not provided |
C. | Compile time error because size of array is not provided |
D. | Interview Mania |
E. | None of these |
Answer» E. None of these | |
26. |
What will be the output of the following C code?
|
A. | Scope rules followed |
B. | Nothing will be printed as value of n is not zero because i is an automatic variable |
C. | Compile time error due to multiple declaration |
D. | Compile time error due to not defining type in statement extern n |
E. | None of these |
Answer» B. Nothing will be printed as value of n is not zero because i is an automatic variable | |
27. |
What will be the output of the following C code?
|
A. | 25 |
B. | Compilation Error |
C. | Runtime Error |
D. | 0 |
E. | None of these |
Answer» E. None of these | |
28. |
What will be the sequence of allocation and deletion of variables in the following C code?
|
A. | var->num, num->var |
B. | var->num, var->num |
C. | num->var, var->num |
D. | num->var, num->var |
E. | None of these |
Answer» D. num->var, num->var | |
29. |
What will happen if the below program is executed?
|
A. | It will cause a compile-time error |
B. | It will cause a run-time error |
C. | It will run without any error and prints |
D. | It will experience infinite looping |
Answer» D. It will experience infinite looping | |
30. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 17 |
C. | 16 |
D. | Garbage value |
E. | None of these |
Answer» B. 17 | |
31. |
Comment on the following 2 C Example programs.
|
A. | Scope of r is till the end of the main function in Example 2 |
B. | In Example 1, variables p, q and r can be used anywhere in main function whereas in Example 2, variables q and r can be used only inside their respective blocks. |
C. | Both are same |
D. | Scope of p, q and r is till the end of the main function in Example 2. |
E. | None of these |
Answer» C. Both are same | |
32. |
Which variable has the longest scope in the following C code?
|
A. | p |
B. | q |
C. | r |
D. | both p and r |
E. | None of these |
Answer» B. q | |
33. |
Comment on the output of the following C code.
|
A. | Redeclaration of m in same scope throws error |
B. | Syntax error in declaration of m |
C. | m is out of scope when printf is called |
D. | No errors, program will show the output 15 |
E. | None of these |
Answer» C. m is out of scope when printf is called | |
34. |
What will be the output of the following C code?
|
A. | 51 |
B. | 91 |
C. | 41 |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
35. |
What will be the output of the following C code?
|
A. | Undefined |
B. | Compilation Error |
C. | 81 |
D. | Garbage value |
E. | None of these |
Answer» C. 81 | |
36. |
What will be the output of the following C code?
|
A. | 14 |
B. | 0 |
C. | Undefined |
D. | Compilation Error |
E. | None of these |
Answer» B. 0 | |
37. |
What will be the output of the following C code?
|
A. | 15 13 |
B. | 13 15 |
C. | 13 18 |
D. | 18 13 |
E. | None of these |
Answer» E. None of these | |
38. |
What will be the output of the following C code?
|
A. | 14 |
B. | 13 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» B. 13 | |
39. |
What will be the output of the following C code?
|
A. | s is 0 |
B. | Compilation Error |
C. | Runtime Error |
D. | Garbage value |
E. | None of these |
Answer» C. Runtime Error | |
40. |
What will be the output of the following C code?
|
A. | Runtime Error |
B. | num is 0 |
C. | Compilation Error |
D. | Garbage value |
E. | None of these |
Answer» C. Compilation Error | |
41. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Runtime Error |
C. | Garbage value |
D. | R is 0 |
E. | None of these |
Answer» E. None of these | |
42. |
What will be the output of the following C code?
|
A. | 10 11 |
B. | 11 10 |
C. | 12 11 |
D. | 11 12 |
E. | None of these |
Answer» E. None of these | |
43. |
What will be the output of the following C code if these two files namely sample.c and sample1.c are linked and run?
|
A. | 0 0 |
B. | 0 12 |
C. | 12 0 |
D. | 12 12 |
E. | None of these |
Answer» D. 12 12 | |
44. |
What will be the output of the following C code?
|
A. | 12 13 |
B. | 13 12 |
C. | 12 |
D. | 13 |
E. | Compilation Error |
Answer» F. | |
45. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 13 |
C. | 14 |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
46. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Compilation Error |
C. | Nothing |
D. | 0 |
E. | None of these |
Answer» E. None of these | |
47. |
What will be the output of the following C code?
|
A. | main is called once |
B. | Segmentation fault |
C. | main is called thrice |
D. | main is called twice |
E. | None of these |
Answer» C. main is called thrice | |
48. |
What will be the output of the following C code?
|
A. | 0 |
B. | Garbage value |
C. | Compilation error |
D. | Varies |
E. | None of these |
Answer» D. Varies | |
49. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Garbage value |
C. | Depends on the compiler |
D. | Depends on the standard |
E. | 110 |
Answer» F. | |
50. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Depend on compiler |
C. | Depends on the standard |
D. | 12 |
E. | None of these |
Answer» B. Depend on compiler | |