

MCQOPTIONS
This section includes 83 Mcqs, each offering curated multiple-choice questions to sharpen your Structures, Unions, Enums knowledge and support exam preparation. Choose a topic below to get started.
51. |
What will be the output of the following C code?
|
A. | yes |
B. | no |
C. | 2 |
D. | error |
Answer» C. 2 | |
52. |
What will be the output of the following C code?
|
A. | error |
B. | pass |
C. | fail |
Answer» B. pass | |
53. |
What will be the output of the following C code?
|
A. | 3 |
B. | Same as the size of an integer |
C. | 3 times the size of an integer |
D. | Error |
Answer» C. 3 times the size of an integer | |
54. |
Pick the incorrect statement with respect to enums. |
A. | Two enum symbols cannot have the same value |
B. | Only integer constants are allowed in enums |
C. | It is not possible to change the value of enum symbols |
D. | Enum variables are automatically assigned values if no value is specified |
Answer» B. Only integer constants are allowed in enums | |
55. |
What is the output of this program?
|
A. | Nothing |
B. | Compile time error |
C. | Junk |
D. | 50 |
Answer» E. | |
56. |
For the following function call which option is not possible? func(&s.a); //where s is a variable of type struct and a is the member of the struct. |
A. | Compiler can access entire structure from the function |
B. | Individual members address can be displayed in structure |
C. | Individual member can be passed by reference in a function |
D. | None of the above |
Answer» B. Individual members address can be displayed in structure | |
57. |
Which of the following is an incorrect syntax to pass by reference a member of a structure in a function?
|
A. | func(&s.a); |
B. | func(&(s).a); |
C. | func(&(s.a)); |
D. | None of the above |
Answer» E. | |
58. |
Number of bytes in memory taken by the below structure is
|
A. | Multiple of integer size |
B. | Integer size+character size |
C. | Depends on the platform |
D. | Multiple of word size |
Answer» B. Integer size+character size | |
59. |
Which of the following are incorrect syntax for pointer to structure?
|
A. | *my_struct.b = 10; |
B. | (*my_struct).b = 10; |
C. | my_struct->b = 10; |
D. | Both *my_struct.b = 10; and (*my_struct).b = 10; |
Answer» B. (*my_struct).b = 10; | |
60. |
What is the output of this program?
|
A. | 2 |
B. | 4 |
C. | 16 |
D. | 8 |
Answer» E. | |
61. |
What is the output of this program?
|
A. | Nothing |
B. | Compile time error |
C. | hello |
D. | Varies |
Answer» C. hello | |
62. |
What is the output of this program?
|
A. | Garbage value Sridhar |
B. | Sridhar Garbage value |
C. | Sridhar Sridhar |
D. | Compilation Error |
Answer» D. Compilation Error | |
63. |
What is the output of this program?
|
A. | Compilation error |
B. | Garbage value 1931 |
C. | AbdulKalam 1931 |
D. | None of the above |
Answer» D. None of the above | |
64. |
What is the output of this program?
|
A. | chennai 6 |
B. | Nothing will be displayed |
C. | Runtime Error |
D. | Compilation Error |
Answer» E. | |
65. |
What is the output of this program?
|
A. | 4 7.97 |
B. | 4 7.96623 |
C. | Compilation error |
D. | None of the above |
Answer» B. 4 7.96623 | |
66. |
What is the output of this program?
|
A. | 2 |
B. | 3 |
C. | 4 |
Answer» C. 4 | |
67. |
What is the output of this program?
|
A. | -1 0 4 5 6 7 |
B. | -1 0 1 2 3 4 |
C. | 0 1 2 3 4 5 |
D. | Error |
Answer» B. -1 0 1 2 3 4 | |
68. |
What is the output of this program?
|
A. | hello |
B. | 5hello |
C. | hello5 |
D. | 6hello |
Answer» D. 6hello | |
69. |
What is the output of this program?
|
A. | 100 0 |
B. | 100 100 |
C. | 0 0 |
D. | Compilation Error |
Answer» E. | |
70. |
Which of the following accesses a variable in structure b? |
A. | b->var; |
B. | b.var; |
C. | b-var; |
D. | b>var; |
Answer» C. b-var; | |
71. |
What will be the size of the following structure?
|
A. | 12 |
B. | 8 |
C. | 10 |
D. | 9 |
Answer» B. 8 | |
72. |
What is the output of this program?
|
A. | Maths 100 |
B. | Science 85 |
C. | Science 90 |
D. | Science 100 |
Answer» C. Science 90 | |
73. |
What is the output of this program?
|
A. | 0.416666666666667 |
B. | garbage value garbage value |
C. | Compilation Error |
D. | None of these |
Answer» B. garbage value garbage value | |
74. |
What is the output of this program?
|
A. | Error |
B. | garbage value garbage value |
C. | None of these |
Answer» C. None of these | |
75. |
Which of the following is a properly defined struct? |
A. | struct {int a;} |
B. | struct a_struct {int a;} |
C. | struct a_struct int a; |
D. | struct a_struct {int a;}; |
Answer» E. | |
76. |
Which of the following accesses a variable in structure *b? |
A. | b->var; |
B. | b.var; |
C. | b-var; |
D. | b>var; |
Answer» B. b.var; | |
77. |
Which properly declares a variable of struct foo? |
A. | struct foo; |
B. | struct foo var; |
C. | foo; |
D. | int foo; |
Answer» C. foo; | |
78. |
Which operator connects the structure name to its member name? |
A. | - |
B. | . |
C. | Both (b) and (c) |
D. | None of the above |
Answer» C. Both (b) and (c) | |
79. |
Predict the output of above program. Assume that the size of an integer is 4 bytes and size of character is 1 byte. Also assume that there is no alignment needed.
|
A. | Nothing is printed |
B. | G |
C. | Garbage character followed by 'G' |
D. | Garbage character followed by 'G', followed by more garbage characters |
Answer» B. G | |
80. |
#include
|
A. | Compiler Error |
B. | 10 |
C. | Runtime Error |
D. | Garbage Value |
Answer» B. 10 | |
81. |
Consider the following C declaration Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is |
A. | 22 bytes |
B. | 14 bytes |
C. | 18 bytes |
D. | 10 bytes |
Answer» D. 10 bytes | |
82. |
Consider the following C declaration Assume that the objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment consideration, is |
A. | 22 bytes |
B. | 18 bytes |
C. | 14 bytes |
D. | 10 bytes |
Answer» C. 14 bytes | |
83. |
#include stdio.h int main() { struct site { char name[] = "GeeksQuiz"; int no_of_pages = 200; }; struct site *ptr; printf("%d ", ptr->no_of_pages); printf("%s", ptr->name); getchar(); return 0; }
|
A. | 200 GeeksQuiz |
B. | 200 |
C. | Runtime Error |
D. | Compiler Error |
Answer» E. | |