Structure & Union Questions and Answers

Practice Mode
Showing 10 of 95 questions
Q41
Find the output. void main ( ) { struct { char name [10]; int age; }abc; static struct abc={"raja", 15}; printf("%s %d, abc.name, abc. age); }
  • A raja 15
  • B 0 0
  • C Garbage output
  • D Compilation error
Answer: Option D
Q42
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); }
  • A p cpuri cuttack
  • B puri cuttack puri cuttack
  • C Garbage Garbage puri cuttack
  • D None of these
Answer: Option A
Q43
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); }
  • A 10 raja
  • B Garbage Raja
  • C compilation error
  • D Noneo of these
Answer: Option C
Q44
Find out the odd one
  • A The disadvantage of using bit fileds lies in the lack of portability.
  • B The address operator &, cannot be used with bit fields
  • C Bit fields can be specified in a structure declaration without a name.
  • D None of these
Answer: Option A
Q45
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"); }
  • A same
  • B Different
  • C Compilation error
  • D None of these
Answer: Option C
Q46
Find the output struct byte { int i:9; int b:5; int c; char ch; }; void main ( ) { struct byte b; printf("%d", sizeof(b)); }
  • A 5
  • B 7
  • C 6
  • D None of these
Answer: Option A
Q47
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); }
  • A 10 Tuni
  • B Compilation error
  • C Runtime Error
  • D None of these
Answer: Option B
Q48
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++; }
  • A 80
  • B 81
  • C Compilation error
  • D None of these
Answer: Option A
Q49
The memory allocated for union is internally done through
  • A malloc()
  • B calloc()
  • C farmalloc()
  • D None of these
Answer: Option A
Q50
The memory allocated for union is internally done through
  • A Malloc()
  • B calloc()
  • C farmalloc()
  • D None of these
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test