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

21. State the true statement.

  • The structure elements are always arranged in contiguous memory locations.
  • A structure can be read as a single entity
  • A structure can be a member with in it.
  • None of these
Show Answer Report

22. Find the output. typedef struct bitfield { int a:3; char b:7; unsigned int c:12; }bit; void main ( ) { bit b1; printf"%d", sizeof(b1)); }

  • 22
  • 5
  • 3
  • 2
Show Answer Report

23. Find the output. struct bits { unsigned int a:3; }; void main ( ) { struct bits b={8}' printf ("5d", b.a); }

  • 8
  • 3
  • 0
  • None of these
Show Answer Report

24. Find the output struct student { char nm[10]; int roll; }; void main ( ) { struct student *s,p={raja", 5}' s=&p; printf("%d %s", *s.nm,*s.roll); }

  • raja 5
  • Garbage garbage
  • Non portable pointers conversion
  • Compilation error
Show Answer Report

25. Structure is used for

  • Data encapsulation
  • Create memory link
  • Bit fields
  • All of the above
Show Answer Report

26. All structure variables are created in

  • Code area
  • Stack area
  • Data area
  • Depends on storage class
Show Answer Report

27. Find the output struct st { char *name; int age; int (*p) ( ); }; void main ( ) { struct st s={"raja", 10}; s.p=show (&s); } show (struct st *s) { printf('%s", ++s->name); }

  • Raja
  • aja
  • Pointer to function can't be a part of structure
  • None of these
Show Answer Report

28. Can members of a union be same as that of structure member if union is nested withing that structure ?

  • yes
  • No
  • Can't say
  • Gives runtime error
Show Answer Report

29. Find the output struct x { char *x; }; void main ( ) { struct x x={"rama"}; printf("%s", x.x); }

  • rama
  • Compilation error
  • Runtime error
  • None of these
Show Answer Report

30. Find the output struct main { int n; int (*p) ( ); }; void main ( ) { struct main m; int fun( ); m.p=fun; * (m.p) ( ); } fun ( ) { printf("Hello"); }

  • Hello
  • Hello Hello
  • No output
  • Compilation error
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test