Structure & Union Questions and Answers

Practice Mode
Showing 10 of 95 questions
Q31
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); }
  • A 16 1
  • B 0 1
  • C 0 -1
  • D None of these
Answer: Option C
Q32
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); }
  • A 12
  • B 11
  • C 21
  • D 22
Answer: Option A
Q33
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"); } }
  • A Allowed
  • B Not allowed
  • C No
  • D Compilation error
Answer: Option D
Q34
Find the correct output #incoude "stdio.h" void main ( ) { printf("%d", stdin->bsize); }
  • A 256
  • B 512
  • C 1024
  • D None of these
Answer: Option B
Q35
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); }
  • A 10 raja
  • B 10 garbage
  • C Erro, Ivalue required
  • D None of these
Answer: Option C
Q36
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); }
  • A z
  • B zz
  • C zaa
  • D zza
Answer: Option D
Q37
State the true statement.
  • A Bit-fields are allocated from left to right.
  • B A bit-field shall cross its unit boundary.
  • C Complex data types can be created using nested stucture.
  • D All of the above
Answer: Option C
Q38
Find the correct output void main { struct xxx { char c[10]='CITE"; int i=2001; }; struct xxx a; printf('%s', a.c); }
  • A CITE
  • B C
  • C Compilation error
  • D None of these
Answer: Option C
Q39
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); }
  • A 10 milan puri
  • B 20 puri puri
  • C 20 milan puri
  • D Compilation error
Answer: Option D
Q40
Which of the following is limitation of bit filed?
  • A Bit fileds do not have addresses.
  • B Bit fields cannot be read using scanf() function.
  • C They cannot store values beyond their limits.
  • D All of the above
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test