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

41. Find the output. void main ( ) { struct { char name [10]; int age; }abc; static struct abc={"raja", 15}; printf("%s %d, abc.name, abc. age); }

  • raja 15
  • 0 0
  • Garbage output
  • Compilation error
Show Answer Report

42. Find the output void main ( ) { struct st { char x[10]; char *ptr; }; struct st s={"puri","cuttrack"}; print ("%c%c",s.x[0], s.ptr[0]); printf("%s %s", s.x.s.ptr); }

  • p cpuri cuttack
  • puri cuttack puri cuttack
  • Garbage Garbage puri cuttack
  • None of these
Show Answer Report

43. Find the output typedef struct { int roll; char name[15]; }student; void main ( ) { student s1, s2; s2=s1={10, "Raja"}; printf("%d%s", s2.roll, s1.name); }

  • 10 raja
  • Garbage Raja
  • compilation error
  • Noneo of these
Show Answer Report

44. Find out the odd one

  • The disadvantage of using bit fileds lies in the lack of portability.
  • The address operator &, cannot be used with bit fields
  • Bit fields can be specified in a structure declaration without a name.
  • None of these
Show Answer Report

45. Find the outpu struct emp { int eno; char name[10]; }; void main ( ) { struct emp e1={121, "Rama"}; struct emp e2={122, "Dama'}; if(e1==e2) printf("Same"); else printf("Different"); }

  • same
  • Different
  • Compilation error
  • None of these
Show Answer Report

46. Find the output struct byte { int i:9; int b:5; int c; char ch; }; void main ( ) { struct byte b; printf("%d", sizeof(b)); }

  • 5
  • 7
  • 6
  • None of these
Show Answer Report

47. Find the outpu void main ( ) { struct stu { int roll; char name [10]; }; struct stu s={10, "Tuni"}; call (s); } call (struct stu s) { printf ("%d%s", s.roll, s.name); }

  • 10 Tuni
  • Compilation error
  • Runtime Error
  • None of these
Show Answer Report

48. Find the output struct std { int code; char place [10]; }; void fain (struct std); void main ( ) { struct std s={80,"bang"); fain (s); printf("%d", s.code); } void fain (struct std s) { s.code++; }

  • 80
  • 81
  • Compilation error
  • None of these
Show Answer Report

49. The memory allocated for union is internally done through

  • malloc()
  • calloc()
  • farmalloc()
  • None of these
Show Answer Report

50. The memory allocated for union is internally done through

  • Malloc()
  • calloc()
  • farmalloc()
  • None of these
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test