Structure and Union MCQs
Practice free Structure and Union multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 190 questions — no login required.
Question 28medium
In C, can you have a structure as a member of itself (a recursive structure)?
Question 29easy
What is the purpose of the offsetof macro in C?
Question 30easy
Which keyword is used to create a new name for an existing data type in C?
Advertisement
Question 31hard
Find the output of the following program:
void main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d", s->x);
printf("%s", s->name);
}Question 32medium
Consider the following code.
then the acno can be accessed by
struct account{
int acno;
}svar, *pv = &svarthen the acno can be accessed by
Question 33medium
Consider the following declarations:
To assign a color to a flag, the correct statement would be
union id
{
char color;
int size;
};
struct{
char country;
int date;
union id id;
}flag;To assign a color to a flag, the correct statement would be
Advertisement
Question 34hard
For the following structure declaration, find the correct statement.
struct person{
char name[20];
int age;
struct person lady;
};Question 35easy
The restriction with union is
Question 36easy
How many union members can be initialized?