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

31. Find the output struct kkk { char a:4; char b:4; char c:1; int e:2: }; struct kkk k,s={16, 16, 1, 4}; void main ( ) { k =s; printf ("%d %d", k.a, k.c); }

  • 16 1
  • 0 1
  • 0 -1
  • None of these
Show Answer Report

32. Find the output #defne int char #define char int struct student { char name [10]; int roll; }; void main ( ) { struct student s; printf("%d", sizeof (s); }

  • 12
  • 11
  • 21
  • 22
Show Answer Report

33. Find the output struct x { char y; int x; }; void main ( ) { struct xx s={'a', 15}; switch (s) { case 'a': printf("Allowed"); break; case 15: printf("Not allowed"); break; default: printf ("No"); } }

  • Allowed
  • Not allowed
  • No
  • Compilation error
Show Answer Report

34. Find the correct output #incoude "stdio.h" void main ( ) { printf("%d", stdin->bsize); }

  • 256
  • 512
  • 1024
  • None of these
Show Answer Report

35. Find the output struct xyz { int x; char y[5]; }; void main ( ) { struct xyz m; m.x=10; m.y="raja"; printf("%d %s", m.x, m.y); }

  • 10 raja
  • 10 garbage
  • Erro, Ivalue required
  • None of these
Show Answer Report

36. What is the output of the following program if you press 'z' then 'a' in keyboard void main ( ) { char ch; while ((ch=getche( ))==="z"); printf("%c", ch); }

  • z
  • zz
  • zaa
  • zza
Show Answer Report

37. State the true statement.

  • Bit-fields are allocated from left to right.
  • A bit-field shall cross its unit boundary.
  • Complex data types can be created using nested stucture.
  • All of the above
Show Answer Report

38. Find the correct output void main { struct xxx { char c[10]='CITE"; int i=2001; }; struct xxx a; printf('%s', a.c); }

  • CITE
  • C
  • Compilation error
  • None of these
Show Answer Report

39. Find the output struct student { int roll; char name [10]; char city [10]; }; struct student s={10,"milan","puri"}*p; void main ( ) { p=*s; p->roll=20; p->name=s.city; printf("%d %s %s", s.roll, s.name, p->city); }

  • 10 milan puri
  • 20 puri puri
  • 20 milan puri
  • Compilation error
Show Answer Report

40. Which of the following is limitation of bit filed?

  • Bit fileds do not have addresses.
  • Bit fields cannot be read using scanf() function.
  • They cannot store values beyond their limits.
  • All of the above
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test