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