![]() |
VOOZH | about |
Prerequisite: Structure and Union
QUE.1 What is the output of this program?
OPTION
a) Error
b) 0, A, 10.5
c) 0, A, 10.500000
d) No Error, No Output
Answer: a
Explanation: Error: Can not initialize members here. We can only declare members inside the structure, initialization of member with declaration is not allowed in structure declaration.
QUE.2 What is the output of this program?
OPTION
a) 4
b) 6
c) 8
d) 12
Answer: a
Explanation: struct bitfield bit1={2, 14, 1}; when we initialize it, it will take only one value that will be int and size of int is 4
QUE. 3 What is the output of this program?
OPTION
a) ERROR
b) IHelp, 10
c) IHelp, 0
d) Ihelp, 10
Answer : d
Explanation: It is possible to copy one structure variable into another like h1 = h2. Hence value of h2. str is assigned to h1.str.
QUE.4 What is the output?
OPTION
a) 0
b) 100
c) ERROR
d) Warning
Answer
Answer : b
Explanation : This type of declaration is allowed in c.
QUE.5 what is output of this program?
OPTION
a) 10, 10
b) 10, 0
c) 0, 10
d) Compile Error
Answer : d
Explanation : Error: Invalid Initialization. You cannot initialize an union variable like this.
Next Quiz onStructure and Union