

MCQOPTIONS
Saved Bookmarks
This section includes 52 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?
|
A. | 2.2 2.50 2.50 2.5 |
B. | 2.2e 2.25f 2.00 2.25 |
C. | 2.250000e + 000 2.250000 2.25 2.250000 |
D. | Error |
Answer» D. Error | |
2. |
Which of the following is the correct output for the program given below?
|
A. | 4.320000e + 001 43.200001 43.2 |
B. | 4.3 43.22 43.21 |
C. | 4.3e 43.20f 43.00 |
D. | Error |
Answer» B. 4.3 43.22 43.21 | |
3. |
Which of the following statements are correct about the program given below?
|
A. | The program will output C |
B. | The program will output C++ |
C. | Compiler will report an error saying a float cannot be compared with a double. |
D. | Output will be C for 16-bit compilers and C++ for 32-bit compilers |
Answer» B. The program will output C++ | |
4. |
Which of the following is the correct output for the program given below?
int main ( ) { float n = 2.39; printf("%f %f n", ceil (n), floor (n)) ; return 0 ; } |
A. | 3.000000 2.000000 |
B. | 2.500000 2.500000 |
C. | 2.550000 3.000000 |
D. | 2.000000 3.000000 |
Answer» B. 2.500000 2.500000 | |
5. |
Which of the following is the correct output for the program given below?
|
A. | 7.0 |
B. | 7 |
C. | 7.000000 |
D. | Error : Prototype of sqrt ( ) not found |
Answer» D. Error : Prototype of sqrt ( ) not found | |
6. |
Which of the following is the correct output for the program given below?
|
A. | 2 in 16-bit compiler like TC/TC++, 4 in 32-bit compiler like Visual studio or gcc |
B. | 4 in 16-bit compiler like TC/TC++, 2 in 32-bit compiler like Visual Studio or gcc |
C. | 4 in 16-bit compiler like TC/TC++, 4 in 32-bit compiler like Visual Studio or gcc |
D. | 2 in 16-bit compiler like TC/TC++, 2 in 32-bit compiler like Visual studio or gcc |
Answer» B. 4 in 16-bit compiler like TC/TC++, 2 in 32-bit compiler like Visual Studio or gcc | |
7. |
Which error are you likely to get when you run the following program in TC/TC++?
|
A. | Suspicious pointer conversion |
B. | Floating point formats not linked |
C. | Cannot use scanf ( ) for structures |
D. | Strings cannot be nested inside structures |
Answer» C. Cannot use scanf ( ) for structures | |
8. |
If the binary equivalent of 5.375 in normalized form is 0100 0000 1010 1100 0000 0000 0000 0000, what will be the output of the following program?
|
A. | 40 AC 00 00 |
B. | 04 CA 00 00 |
C. | 00 00 AC 40 |
D. | 00 00 CA 04 |
Answer» D. 00 00 CA 04 | |
9. |
What will be the output of the following C code?
|
A. | Advanced C Classes |
B. | Interview Mania |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» B. Interview Mania | |
10. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | I |
C. | 73.000000 |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
11. |
What will be the output of the following C code?
|
A. | Yes |
B. | No |
C. | Depends on the compiler |
D. | Depends on the compiler |
E. | None of these |
Answer» C. Depends on the compiler | |
12. |
What will be the output of the following C code?
|
A. | 98 |
B. | Compilation error |
C. | b |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
13. |
What will be the output of the following C code?
|
A. | 23458965, 0.000000 |
B. | 0.000000, 23458965 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» B. 0.000000, 23458965 | |
14. |
What will be the output of the following C code? (Initial values: p= 10, q = 12)
|
A. | 10.000000, 12 |
B. | 12, 10.000000 |
C. | 12, Garbage value |
D. | Garbage value, 10.000000 |
E. | 10.000000, Garbage value |
Answer» F. | |
15. |
What will be the output of the following C code?
|
A. | 25 |
B. | Yes |
C. | No |
D. | Depends on the compiler |
E. | Depends on the standard |
Answer» D. Depends on the compiler | |
16. |
What will be the output of the following C code on a 32-bit machine?
|
A. | 210 |
B. | 65 |
C. | Depends on compiler |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
17. |
In the following C code, the union size is decided by?
|
A. | float |
B. | int |
C. | both float and int |
D. | char |
E. | None of these |
Answer» D. char | |
18. |
What will be the data type of the result of the following operation?
|
A. | double |
B. | float |
C. | long |
D. | int |
E. | None of these |
Answer» B. float | |
19. |
What will be the output of the following C code considering the size of short int is 2, char is 1 and int is 4 bytes?
|
A. | 23 |
B. | 99 |
C. | 2, 1, 4 |
D. | 4, 1, 2 |
E. | None of these |
Answer» D. 4, 1, 2 | |
20. |
What will be the output of the following C code on a 64 bit machine?
|
A. | str |
B. | Compilation Error |
C. | 4 |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
21. |
What will be the output of the following C code?
|
A. | 4.890000 |
B. | 4.89 |
C. | 4 |
D. | 5 |
E. | None of these |
Answer» E. None of these | |
22. |
What will be the output of the following C code?
|
A. | Garbage value, 0.200000 |
B. | 0.200000, Garbage value |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» B. 0.200000, Garbage value | |
23. |
Which of the following is the correct output for the program given below?
|
A. | 0 |
B. | 0.0 |
C. | 8.0 |
D. | 8 |
Answer» E. | |
24. |
Which of the following is the correct datatype for the variable n in the statement given below?
|
A. | float |
B. | double |
C. | long double |
D. | Depends upon the memory model that you are using |
Answer» B. double | |
25. |
Which of the following is the correct output for the program given below?
|
A. | 4 4 4 |
B. | 4 8 8 |
C. | 4 8 10 |
D. | 4 8 12 |
Answer» C. 4 8 10 | |
26. |
What will be the output of the following C code?
|
A. | Equal |
B. | Not Equal |
C. | output depends on compiler |
D. | Compilation Error |
E. | None of these |
Answer» B. Not Equal | |
27. |
What will be the output of the following C code?
|
A. | 15.621212121212 |
B. | Compilation Error |
C. | Garbage value |
D. | 15.621212 |
E. | None of these |
Answer» E. None of these | |
28. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | 0.2 |
C. | Equal |
D. | Not Equal |
E. | None of these |
Answer» E. None of these | |
29. |
Which data type is suitable for storing a number like?
|
A. | double |
B. | int |
C. | both int and double |
D. | float |
E. | None of these |
Answer» B. int | |
30. |
What is the output of the following C code?
|
A. | 129 |
B. | -129 |
C. | 127 |
D. | -127 |
E. | None of these |
Answer» E. None of these | |
31. |
What will be the output of the following C code?
|
A. | I |
B. | -1 |
C. | L |
D. | Compilation Error |
E. | None of these |
Answer» B. -1 | |
32. |
Which of the following is the correct output for the program given below?
int main ( ) { float n = 5.375 ; printf("%f %e %E n" , n, n, n) ; return 0 ; } |
A. | 5.375 5.375 5.375 |
B. | 5.375000 5.375000 5.375000 |
C. | 5.375000 5.375000e+000 5.375000E+000 |
D. | 5.375000 5.375000E+000 5.375000e+000 |
Answer» D. 5.375000 5.375000E+000 5.375000e+000 | |
33. |
What is the output of this C code?
|
A. | 128 |
B. | -128 |
C. | Depends on the compiler |
D. | None of the mentioned |
Answer» C. Depends on the compiler | |
34. |
Predict the data type of the following mathematical operation?
|
A. | long |
B. | double |
C. | float |
D. | int |
E. | None of these |
Answer» C. float | |
35. |
Which error are you likely to get when you run the following program in TC/TC++? |
A. | Suspicious pointer conversion |
B. | Floating point formats not linked |
C. | Cannot use scanf ( ) for structures |
D. | Strings cannot be nested inside structures |
Answer» C. Cannot use scanf ( ) for structures | |
36. |
We want to round off x, a float, to an int value. The correct way to do so will be |
A. | y = ( int ) ( x + 0.5); |
B. | y = int ( x +0.5 ); |
C. | y = ( int ) x + 0.5; |
D. | y = ( int ) ( ( int ) x + 0.5 ) |
Answer» B. y = int ( x +0.5 ); | |
37. |
If the binary equivalent of 5.375 in normalized form is 0100 0000 1010 1100 0000 0000 0000 0000, what will be the output of the following program? |
A. | 40 AC 00 00 |
B. | 04 CA 00 00 |
C. | 00 00 AC 40 |
D. | 00 00 CA 04 |
Answer» D. 00 00 CA 04 | |
38. |
Which of the following is valid range of long double ? |
A. | 3.4E-4932 to 1.1E+4932 |
B. | 3.4E-4932 to 3.4E+4932 |
C. | 1.1E-4932 to 1.1E+4932 |
D. | 1.7E - 308 to 1.7E + 308 |
Answer» E. | |
39. |
What is the range of a signed char variable in C? |
A. | 0 to 255 |
B. | -128 to 127 |
C. | 0 to 127 |
D. | -128 to 255 |
Answer» C. 0 to 127 | |
40. |
Which of the following is the correct datatype for the variable n in the statement given below? |
A. | float |
B. | double |
C. | long double |
D. | Depends upon the memory model that you are using |
Answer» B. double | |
41. |
Predict the data type of the following mathematical operation? |
A. | long |
B. | double |
C. | float |
D. | int |
E. | None of these |
Answer» C. float | |
42. |
Which data type is suitable for storing a number like? |
A. | double |
B. | int |
C. | both int and double |
D. | float |
E. | None of these |
Answer» B. int | |
43. |
%f access specifier is used for ________. |
A. | Integral types |
B. | Floating type |
C. | Strings |
D. | All of above |
E. | None of these |
Answer» C. Strings | |
44. |
In the following C code, the union size is decided by? |
A. | float |
B. | int |
C. | both float and int |
D. | char |
E. | None of these |
Answer» D. char | |
45. |
What will be the data type of the result of the following operation? |
A. | double |
B. | float |
C. | long |
D. | int |
E. | None of these |
Answer» B. float | |
46. |
What will be the output of the following C code considering the size of short int is 2, char is 1 and int is 4 bytes? |
A. | 23 |
B. | 99 |
C. | 2, 1, 4 |
D. | 4, 1, 2 |
E. | None of these |
Answer» D. 4, 1, 2 | |
47. |
function tolower(c) defined in library
|
A. | Unicode character set |
B. | Ascii and utf-8 but not EBCDIC character set |
C. | Ascii character set |
D. | Any character set |
E. | None of these |
Answer» E. None of these | |
48. |
The format identifier %i is also used for _____ data type. |
A. | double |
B. | char |
C. | int |
D. | float |
E. | None of these |
Answer» D. float | |
49. |
What will be the output of the following C code? (Initial values: p= 10, q = 12) |
A. | 10.000000, 12 |
B. | 12, 10.000000 |
C. | 12, Garbage value |
D. | Garbage value, 10.000000 |
E. | 10.000000, Garbage value |
Answer» F. | |
50. |
What will be the output of the following C code on a 64 bit machine? |
A. | str |
B. | Compilation Error |
C. | 4 |
D. | All of above |
E. | None of these |
Answer» D. All of above | |