

MCQOPTIONS
Saved Bookmarks
This section includes 50 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. |
Point out the error in the program?
#include
|
A. | Error: invalid union declaration |
B. | Error: in Initializing z2 |
C. | No error |
D. | None of above |
Answer» C. No error | |
2. |
Point out the error in the program?
#include
|
A. | Prints: The structure are equal |
B. | Error: Structure cannot be compared using '==' |
C. | No output |
D. | None of above |
Answer» C. No output | |
3. |
Point out the error in the program?
#include
|
A. | 4 |
B. | 2 |
C. | Error: cannot set bit field for float |
D. | Error: Invalid member access in structure |
Answer» D. Error: Invalid member access in structure | |
4. |
Is it necessary that the size of all elements in a union should be same? |
A. | Yes |
B. | No |
Answer» C. | |
5. |
What will be the output of the program in Turbo C (under DOS)?
#include
|
A. | Error: Invalid structure assignment |
B. | DRAVID |
C. | Dravid |
D. | No output |
Answer» C. Dravid | |
6. |
The '.' operator can be used access structure elements using a structure variable. |
A. | 1 |
B. | |
Answer» B. | |
7. |
Will the following declaration work? typedef struct s { int a; float b; }s; |
A. | Yes |
B. | No |
Answer» B. No | |
8. |
If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes? struct ex { char ch; int i; long int a; }; |
A. | Yes |
B. | No |
Answer» C. | |
9. |
What will be the output of the program given below in 16-bit platform ?
#include
|
A. | 1 |
B. | 2 |
C. | 4 |
D. | 10 |
Answer» C. 4 | |
10. |
A structure can contain similar or dissimilar elements |
A. | 1 |
B. | |
Answer» B. | |
11. |
Can we have an array of bit fields? |
A. | Yes |
B. | No |
Answer» C. | |
12. |
What will be the output of the program in 16-bit platform (under DOS)?
#include
|
A. | 2, 2 |
B. | 8, 8 |
C. | 5, 5 |
D. | 4, 4 |
Answer» B. 8, 8 | |
13. |
What will be the output of the program ?
#include
|
A. | 1 |
B. | -1 |
C. | 0 |
D. | Error |
Answer» C. 0 | |
14. |
Union elements can be of different sizes. |
A. | 1 |
B. | |
Answer» B. | |
15. |
What will be the output of the program ?
#include
|
A. | 103 DotNet |
B. | 102 Java |
C. | 103 PHP |
D. | 104 DotNet |
Answer» B. 102 Java | |
16. |
What will be the output of the program ?
#include
|
A. | 12, 12, 12 |
B. | 112, 1, 12 |
C. | 32, 1, 12 |
D. | -64, 1, 12 |
Answer» B. 112, 1, 12 | |
17. |
By default structure variable will be of auto storage class |
A. | Yes |
B. | No |
Answer» B. No | |
18. |
The '->' operator can be used to access structures elements using a pointer to a structure variable only |
A. | 1 |
B. | |
Answer» B. | |
19. |
Point out the error in the program in 16-bit platform?
#include
|
A. | 4 |
B. | 2 |
C. | Error: Bit field too large |
D. | Error: Invalid member access in structure |
Answer» D. Error: Invalid member access in structure | |
20. |
The elements of union are always accessed using & operator |
A. | Yes |
B. | No |
Answer» C. | |
21. |
A structure can be nested inside another structure. |
A. | 1 |
B. | |
Answer» B. | |
22. |
What will be the output of the program ?
#include
|
A. | 0, 1, 2 |
B. | 1, 2, 3 |
C. | 0, 2, 1 |
D. | 1, 3, 2 |
Answer» D. 1, 3, 2 | |
23. |
Point out the error in the program? typedef struct data mystruct; struct data { int x; mystruct *b; }; |
A. | Error: in structure declaration |
B. | Linker Error |
C. | No Error |
D. | None of above |
Answer» D. None of above | |
24. |
A pointer union CANNOT be created |
A. | Yes |
B. | No |
Answer» C. | |
25. |
Which of the following statements correct about the below program?
#include
|
A. | 1, 2 |
B. | 2, 3 |
C. | 1, 2, 3 |
D. | 1, 3, 4 |
Answer» D. 1, 3, 4 | |
26. |
What will be the output of the program ?
#include
|
A. | 10 |
B. | 20 |
C. | 30 |
D. | 0 |
Answer» C. 30 | |
27. |
Point out the error in the program?
#include
|
A. | Error: Lvalue required/incompatible types in assignment |
B. | Error: invalid constant expression |
C. | Error: Rvalue required |
D. | No error, Output: Suresh 25 |
Answer» B. Error: invalid constant expression | |
28. |
Which of the following statements correctly assigns 12 to month using pointer variable pdt?
#include
|
A. | pdt.month = 12 |
B. | &pdt.month = 12 |
C. | d.month = 12 |
D. | pdt->month = 12 |
Answer» E. | |
29. |
Point out the error in the program?
#include
|
A. | Error: invalid structure member in printf |
B. | Error in this float category:5; statement |
C. | No error |
D. | None of above |
Answer» C. No error | |
30. |
size of union is size of the longest element in the union |
A. | Yes |
B. | No |
Answer» B. No | |
31. |
It is not possible to create an array of pointer to structures. |
A. | 1 |
B. | |
Answer» C. | |
32. |
one of elements of a structure can be a pointer to the same structure. |
A. | 1 |
B. | |
Answer» B. | |
33. |
Point out the error in the program? struct emp { int ecode; struct emp e; }; |
A. | Error: in structure declaration |
B. | Linker Error |
C. | No Error |
D. | None of above |
Answer» B. Linker Error | |
34. |
Can a structure can point to itself? |
A. | Yes |
B. | No |
C. | Yes |
D. | No |
Answer» B. No | |
35. |
Nested unions are allowed |
A. | 1 |
B. | |
Answer» B. | |
36. |
Point out the error in the program?
#include
|
A. | Error: in structure |
B. | Error: in prototype declaration unknown struct emp |
C. | No error |
D. | None of above |
Answer» C. No error | |
37. |
Point out the error in the program?
#include
|
A. | Error: invalid structure member |
B. | Error: Floating point formats not linked |
C. | No error |
D. | None of above |
Answer» C. No error | |
38. |
What will be the output of the program ?
#include
|
A. | 1, 2, 13 |
B. | 1, 4, 4 |
C. | -1, 2, -3 |
D. | -1, -2, -13 |
Answer» D. -1, -2, -13 | |
39. |
What will be the output of the program ?
#include
|
A. | -1, 0, 1, 2, 3, 4 |
B. | -1, 2, 6, 3, 4, 5 |
C. | -1, 0, 6, 2, 3, 4 |
D. | -1, 0, 6, 7, 8, 9 |
Answer» E. | |
40. |
What will be the output of the program ?
#include
|
A. | -1, 0, 1, 2, 3, 4 |
B. | Error |
C. | 0, 1, 6, 3, 4, 5 |
D. | 0, 0, 6, 7, 8, 9 |
Answer» C. 0, 1, 6, 3, 4, 5 | |
41. |
Is there easy way to print enumeration values symbolically? |
A. | Yes |
B. | No |
C. | Yes |
D. | No |
Answer» C. Yes | |
42. |
Will the following code work?
#include
|
A. | Yes |
B. | No |
Answer» B. No | |
43. |
Which of the following statements correct about the below code? maruti.engine.bolts=25; |
A. | Structure bolts is nested within structure engine. |
B. | Structure engine is nested within structure maruti. |
C. | Structure maruti is nested within structure engine. |
D. | Structure maruti is nested within structure bolts. |
Answer» C. Structure maruti is nested within structure engine. | |
44. |
Bit fields CANNOT be used in union. |
A. | 1 |
B. | |
Answer» C. | |
45. |
What will be the output of the program in 16 bit platform (Turbo C under DOS) ?
#include
|
A. | 1 |
B. | 2 |
C. | 4 |
D. | 9 |
Answer» C. 4 | |
46. |
A union cannot be nested in a structure |
A. | 1 |
B. | |
C. | 1 |
D. | |
Answer» C. 1 | |
47. |
If the following structure is written to a file using fwrite(), can fread() read it back successfully? struct emp { char *n; int age; }; struct emp e={"IndiaBIX", 15}; FILE *fp; fwrite(&e, sizeof(e), 1, fp); |
A. | Yes |
B. | No |
C. | Yes |
D. | No |
Answer» C. Yes | |
48. |
What will be the output of the program ?
#include
|
A. | 3, 2, 515 |
B. | 515, 2, 3 |
C. | 3, 2, 5 |
D. | 515, 515, 4 |
Answer» B. 515, 2, 3 | |
49. |
Which of the following statements correct about the below program?
#include
|
A. | Error: scanf() function cannot be used for structures elements. |
B. | The code runs successfully. |
C. | Error: Floating point formats not linked Abnormal program termination. |
D. | Error: structure variable must be initialized. |
Answer» D. Error: structure variable must be initialized. | |
50. |
Point out the error in the program? struct emp { int ecode; struct emp *e; }; |
A. | Error: in structure declaration |
B. | Linker Error |
C. | No Error |
D. | None of above |
Answer» D. None of above | |