

MCQOPTIONS
Saved Bookmarks
This section includes 24 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. | 10 20 5130 |
B. | 5130 10 20 |
C. | 10 20 50 |
D. | None of the above |
Answer» B. 5130 10 20 | |
2. |
In the following C code, we can access the 1st character of the string sval by using _______.
|
A. | tab[i].u.Str[0]. |
B. | *symtab[i].u.Str |
C. | Both tab[i].u.Str[0]. & *tab[i].u.Str |
D. | You cannot have union inside structure |
E. | None of these |
Answer» D. You cannot have union inside structure | |
3. |
What type of data is holded by variable u int in the following C code?
|
A. | Will be large enough to hold the smallest of the three types; |
B. | Will be large enough to hold the all of the three types; |
C. | Will be large enough to hold the largest of the three types; |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
4. |
What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)
|
A. | 80 |
B. | 8 |
C. | 4 |
D. | 40 |
E. | None of these |
Answer» E. None of these | |
5. |
Which member of the union will be active after REF LINE in the following C code?
|
A. | n |
B. | fl |
C. | ch |
D. | Such declaration are illegal |
E. | None of these |
Answer» B. fl | |
6. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Garbage value |
C. | 65 |
D. | 32 |
E. | None of these |
Answer» D. 32 | |
7. |
What will be the output of the following C code?
|
A. | sizeof(int) + sizeof(char) |
B. | sizeof(char) |
C. | Compilation Error |
D. | Depends on the compiler |
E. | None of these |
Answer» C. Compilation Error | |
8. |
What will be the output of the following C code?
|
A. | sizeof(int) |
B. | Depends on the compiler |
C. | sizeof(int) + sizeof(char) |
D. | Compilation Error |
E. | None of these |
Answer» B. Depends on the compiler | |
9. |
What will be the output of the following C code (Assuming size of int and float is 4)?
|
A. | 32 |
B. | 16 |
C. | 8 |
D. | 4 |
E. | None of these |
Answer» E. None of these | |
10. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Compilation Error |
C. | 26 |
D. | Undefined behaviour |
E. | None of these |
Answer» D. Undefined behaviour | |
11. |
What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8)
|
A. | 32 |
B. | 16 |
C. | 8 |
D. | 4 |
E. | 2 |
Answer» D. 4 | |
12. |
Which of the following share a similarity in syntax?
|
A. | 1 and 2 |
B. | 3 and 4 |
C. | 1, 3 and 4 |
D. | 1 and 3 |
E. | None of these |
Answer» B. 3 and 4 | |
13. |
What will be the output of the following C code?
|
A. | Implementation dependent |
B. | Compilation Error |
C. | 200.000000 |
D. | 0.000000 |
E. | None of these |
Answer» E. None of these | |
14. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Depends on compiler |
C. | Garbage value |
D. | 99 |
E. | None of these |
Answer» E. None of these | |
15. |
What will be the output of the following C code?
|
A. | 99 |
B. | 100 |
C. | Compilation Error |
D. | Garbage value |
E. | None of these |
Answer» C. Compilation Error | |
16. |
The size of a union is determined by the size of the __________. |
A. | Biggest member in the union |
B. | Sum of the sizes of all members |
C. | First member in the union |
D. | Last member in the union |
E. | None of these |
Answer» B. Sum of the sizes of all members | |
17. |
In the following C code, we can access the 1st character of the string sval by using _______. |
A. | tab[i].u.Str[0]. |
B. | *symtab[i].u.Str |
C. | Both tab[i].u.Str[0]. & *tab[i].u.Str |
D. | You cannot have union inside structure |
E. | None of these |
Answer» D. You cannot have union inside structure | |
18. |
What will be the output of the following C code (Assuming size of int and float is 4)? |
A. | 32 |
B. | 16 |
C. | 8 |
D. | 4 |
E. | None of these |
Answer» E. None of these | |
19. |
What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1) |
A. | 80 |
B. | 8 |
C. | 4 |
D. | 40 |
E. | None of these |
Answer» E. None of these | |
20. |
Which member of the union will be active after REF LINE in the following C code? |
A. | n |
B. | fl |
C. | ch |
D. | Such declaration are illegal |
E. | None of these |
Answer» B. fl | |
21. |
What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8) |
A. | 32 |
B. | 16 |
C. | 8 |
D. | 4 |
E. | 2 |
Answer» D. 4 | |
22. |
Members of a union are accessed as________________. |
A. | union-pointer->member |
B. | union-name.member |
C. | both union-pointer->member & union-name.member |
D. | union-name.pointer |
E. | None of these |
Answer» D. union-name.pointer | |
23. |
What type of data is holded by variable u int in the following C code? |
A. | Will be large enough to hold the smallest of the three types; |
B. | Will be large enough to hold the all of the three types; |
C. | Will be large enough to hold the largest of the three types; |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
24. |
Which of the following share a similarity in syntax? |
A. | 1 and 2 |
B. | 3 and 4 |
C. | 1, 3 and 4 |
D. | 1 and 3 |
E. | None of these |
Answer» B. 3 and 4 | |