← All topics
Quiz: Structures and Unions: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. If p is a pointer to a struct, how do you access its member age?
- Q2. What is the size of a union with members char, int and double (double = 8 bytes)?
- Q3. What does this print? (code)
- Q4. Why can sizeof(struct) be bigger than the sum of its members?
- Q5. In a union, how many members hold a valid value at the same time?
- Q6. What does this print? (code)
- Q7. What does this print? (code)
- Q8. What does this print? (code)
- Q9. What does typedef struct Student Student; do?
- Q10. Why do functions usually take a pointer to a large struct, like void show(const struct Student s), rather than the struct itself?