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

51. A union can be a member of

  • Structure
  • Array
  • Both a and B
  • None of these
Show Answer Report

52. Find the correct output void main ( ) { struct emp { int eid; char ename[20]; }; struct emp e={010, "Deepak"}; show (e); } show (struct {int eid; char ename [20];}e) { printf("%0%s", e.eid,e.ename); }

  • 010
  • 010 Deepak
  • None of these
  • Compilation Error
Show Answer Report

53. The minimum and maximum range of Bit field is

  • 0 to 15
  • 1 to 16
  • 0 to 31
  • 1 to 32
Show Answer Report

54. Find the output void main ( ) { struct abc { char ch[10]; int i; }; struct abc a= {"Dear", 10, "Customer", 20}; printf('%s", a.ch); }

  • Dear
  • Customer
  • Compilation error
  • None of these
Show Answer Report

55. In the following program p.a. is same as: struct xxx { int a; int b; }b={9, 10};

  • p->a
  • &p->a
  • (&p)->a
  • *p.a
Show Answer Report

56. Find the output void main ( ) { struct yyy { char ch; int i; }; struct yyy y={'1', 1}; xxx (y); } xxx (struct yyy y) { printf ("%c....%d",y.ch, y.i); }

  • No output
  • Compilation error
  • 1.....1
  • None of these
Show Answer Report

57. Find the output void main () { struct zzz { int i; int j; }pqr; struct zzz *z; z=&pqr; z->=100 z->=200; xxx (z); } xxx (int *p) { p++; printf("%d", *p); }

  • 100
  • 200
  • Compilation error
  • None of these
Show Answer Report

58. Find the output struct xxx { int age; char name [10]; }; void main ( ) { struct xxx *p={26, "raja"}; printf('%s", p->name); }

  • raja
  • Garbage
  • Null pointer assignment
  • Compiltion error
Show Answer Report

59. Find the output union complex { int i; float real; }; void main( ) { union complex c={2}; printf ("%d %f", c.i,c.real); }

  • 2 2.000
  • 2 0
  • 2 0.0000
  • Garbage value
Show Answer Report

60. Find the output struct str { int i; float f; }; union uti { int i; float f; }; void main ( ) { printf("%d", sizeof (struct str) - sizeof (union uti)); }

  • Error: Structure and union variable are not declared
  • Error: Same members are not declared for both structure and union.
  • 2
  • 0
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test