Question 1 of 25
Hints left: 3
Q1
What is the size of an empty structure in C?
Q2
Which keyword is used to define an anonymous structure or union within another structure or union?
Q3
In a union, which member can you access safely after assigning a value to one of its members?
Q4
For the following structure declaration, find the correct statement. struct person{ char name[20]; int age; struct person lady; };
Q5
In C, can you have a structure as a member of itself (a recursive structure)?
Q6
Consider the following declarations: 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
Q7
Which type of variable should you use if you want to store different types of data at different times within the same memory location?
Q8
Which keyword is used to create a new name for an existing data type in C?
Q9
Which keyword is used to access a member of a nested structure in C?
Q10
What is the primary use of a union in a C program?
Q11
Consider the following code. struct account{ int acno; }svar, *pv = &svar; then the acno can be accessed by
Q12
What happens when you assign a value to one member of a union and then access another member in C?
Q13
Which of the following is not a valid type for a structure member in C?
Q14
Which operator is used to access a union member when the union is a part of a structure?
Q15
How do you declare an array of structures in C?
Q16
What is the main advantage of using a union in C?
Q17
What is the purpose of the offsetof macro in C?
Q18
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); }
Q19
What is the purpose of an anonymous union in C?
Q20
In C, can you compare two structures using the equality operator (==)?
Q21
Which of the following is true about the memory allocation of structures and unions in C?
Q22
The restriction with union is
Q23
When should you use a structure instead of an array in C?
Q24
In C, can a structure be passed as an argument to a function?
Q25
What is the purpose of using a typedef with structures and unions in C?