Structure & Union Questions and Answers

Take Exam

Structure & Union Questions with Answers are key topics in C programming questions and answers sections of competitive exams and technical interviews. These concepts allow efficient memory usage and data management, making them essential for understanding advanced C applications. Commonly featured in TCS, Infosys, and Tech Mahindra placement tests, questions on structure and union test your ability to differentiate between memory allocation, member access, and implementation. Practicing C programming MCQs with explanations improves conceptual clarity and debugging skills. Start your preparation with our curated C Structure & Union MCQs and download free PDFs for revision.

Structure & Union

Showing 10 of 95 questions

61. 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);

  • 10
  • 3.14
  • Garbage value
  • Compilation error
Show Answer Report

62. Find the output union abc { int a; long b; }; void main ( ) { union abc x; x. b=10; printf("%1d %d", x.b); }

  • 10 10
  • 10 Garbage value
  • Garbage value 10
  • Compilation error
Show Answer Report

63. Which of the following is flse regarding bit fields?

  • Bit fields may share a storage unit with other structure members
  • Bit fields must entirely reside in a storage unit of its appropriate type.
  • Bit fields only applicable to unsigned integral but not signed integral.
  • Bit fields are used to construct the protocol header fields.
Show Answer Report

64. Which of the following is best suited for memory optimization

  • Union
  • Self referential structure
  • Array
  • Linked list
Show Answer Report

65. Very first member of union is known as

  • smart member
  • Lical member
  • Data member
  • Active member
Show Answer Report

66. Union is

  • A special jtype of structure
  • A pointerdata type
  • A function data type
  • Not a data type
Show Answer Report

67. Find the output union xyz float f; int i; } xx=5.0; void main ( ) { printf ('%f %d", xx.f, xx.i); }

  • 5.0000 0
  • 5.0000 Garbage
  • Garbage garbage
  • Compilation Error
Show Answer Report

68. 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.

  • III & IV
  • II, III & IV
  • I, II & III
  • All of these
Show Answer Report

69. 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]); }

  • Error: Library function not allowed initializing union member.
  • xyz 120
  • xyz 121
  • xyz 122
Show Answer Report

70. The main advantage of union over structure is

  • Memory mapping
  • Memory utilization
  • Memory optimization
  • Memory leak
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test