Structure & Union Questions and Answers

Practice Mode
Showing 10 of 95 questions
Q61
Find the output union xxx { int x; float y; char z; }; void main ( ) { union xxx abc; abc.x=10; abc.y=3.14; printf("%d", abc.x);
  • A 10
  • B 3.14
  • C Garbage value
  • D Compilation error
Answer: Option C
Q62
Find the output union abc { int a; long b; }; void main ( ) { union abc x; x. b=10; printf("%1d %d", x.b); }
  • A 10 10
  • B 10 Garbage value
  • C Garbage value 10
  • D Compilation error
Answer: Option A
Q63
Which of the following is flse regarding bit fields?
  • A Bit fields may share a storage unit with other structure members
  • B Bit fields must entirely reside in a storage unit of its appropriate type.
  • C Bit fields only applicable to unsigned integral but not signed integral.
  • D Bit fields are used to construct the protocol header fields.
Answer: Option C
Q64
Which of the following is best suited for memory optimization
  • A Union
  • B Self referential structure
  • C Array
  • D Linked list
Answer: Option A
Q65
Very first member of union is known as
  • A smart member
  • B Lical member
  • C Data member
  • D Active member
Answer: Option D
Q66
Union is
  • A A special jtype of structure
  • B A pointerdata type
  • C A function data type
  • D Not a data type
Answer: Option A
Q67
Find the output union xyz float f; int i; } xx=5.0; void main ( ) { printf ('%f %d", xx.f, xx.i); }
  • A 5.0000 0
  • B 5.0000 Garbage
  • C Garbage garbage
  • D Compilation Error
Answer: Option D
Q68
Which of the following statements true regarding UNION ? I. Self-referential structure may be used as member of union. II. Niested union is also possible. III. ONe member of a union active at a time. IV. Only active member can be initialized.
  • A III & IV
  • B II, III & IV
  • C I, II & III
  • D All of these
Answer: Option D
Q69
Find the output union usa { unsigned int x[2]; char ch[4]; } canada; void main ( ) { strcpy (canada.ch, "xyz")); printf('%s%d", canada. ch, canada.x[1]); }
  • A Error: Library function not allowed initializing union member.
  • B xyz 120
  • C xyz 121
  • D xyz 122
Answer: Option D
Q70
The main advantage of union over structure is
  • A Memory mapping
  • B Memory utilization
  • C Memory optimization
  • D Memory leak
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test