Structure & Union Questions and Answers

Practice Mode
Showing 10 of 95 questions
Q51
A union can be a member of
  • A Structure
  • B Array
  • C Both a and B
  • D None of these
Answer: Option A
Q52
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); }
  • A 010
  • B 010 Deepak
  • C None of these
  • D Compilation Error
Answer: Option B
Q53
The minimum and maximum range of Bit field is
  • A 0 to 15
  • B 1 to 16
  • C 0 to 31
  • D 1 to 32
Answer: Option B
Q54
Find the output void main ( ) { struct abc { char ch[10]; int i; }; struct abc a= {"Dear", 10, "Customer", 20}; printf('%s", a.ch); }
  • A Dear
  • B Customer
  • C Compilation error
  • D None of these
Answer: Option C
Q55
In the following program p.a. is same as: struct xxx { int a; int b; }b={9, 10};
  • A p->a
  • B &p->a
  • C (&p)->a
  • D *p.a
Answer: Option C
Q56
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); }
  • A No output
  • B Compilation error
  • C 1.....1
  • D None of these
Answer: Option B
Q57
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); }
  • A 100
  • B 200
  • C Compilation error
  • D None of these
Answer: Option B
Q58
Find the output struct xxx { int age; char name [10]; }; void main ( ) { struct xxx *p={26, "raja"}; printf('%s", p->name); }
  • A raja
  • B Garbage
  • C Null pointer assignment
  • D Compiltion error
Answer: Option D
Q59
Find the output union complex { int i; float real; }; void main( ) { union complex c={2}; printf ("%d %f", c.i,c.real); }
  • A 2 2.000
  • B 2 0
  • C 2 0.0000
  • D Garbage value
Answer: Option C
Q60
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)); }
  • A Error: Structure and union variable are not declared
  • B Error: Same members are not declared for both structure and union.
  • C 2
  • D 0
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test