Structure & Union Questions and Answers
Practice ModeShowing 10 of 95 questions
Q81
Find the output
union unit
{
int x;
char y;
};
union neon
{
union unit u;
char ch;
};
void main ( )
{
union neon n={50};
printf("%d %c %c", n.u.x, n.ch, n.u.y);
}
Answer: Option A
Q82
Find the output
union uuu
{
struct student
{
int roll;
char name [10];
float percentage;
};
float sal;
};
void main ( )
{
union uuu u;
printf('%d", sizeof (u));
}
Answer: Option D
Q83
State the correct statement
Answer: Option D
Q84
Find the output
union un
{
int x;
char y;
float z;
};
void main ( )
{
union un *u;
u=(union un*) malloc (sizeof(union un));
u->x=10;
u->'a'
printf("%d", u->x);
}
Answer: Option B
Q85
Which is not possible with union ?
Answer: Option A
Q86
Find the output
#define MAX int a
union uuu
{
MAX;
float b;
};
void main ( )
{
union uuu u={5.5};
printf('%d", u.a);
}
Answer: Option B
Q87
Which of the following is used to increment the pointer "p" to next member of the array?
union choice
{
int x[10];
float f[10];
};
union choice colour[15];
void *p=colour;
Answer: Option C
Q88
Find the output
union xyz
{
char name [10];
char x;
};
void main ( )
{
union xyzp={"raja")};
p.x='i\r';
p.x='ij';
printf("%s", p.name);
}
Answer: Option B
Q89
Find the output
union abc
{
int ;
float f;
}ab;
void main ( )
{
ab.i=23.567;
printf('%f", ab.f);
}
Answer: Option C
Q90
Find the output
union uni
{
int x;
char: 8;
};
void main ( )
{
union uni u={64};
printf("%c");
}
Answer: Option A