🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 →
  1. Q1. If p is a pointer to a struct, how do you access its member age?
  2. Q2. What is the size of a union with members char, int and double (double = 8 bytes)?
  3. Q3. What does this print? (code)
  4. Q4. Why can sizeof(struct) be bigger than the sum of its members?
  5. Q5. In a union, how many members hold a valid value at the same time?
  6. Q6. What does this print? (code)
  7. Q7. What does this print? (code)
  8. Q8. What does this print? (code)
  9. Q9. What does typedef struct Student Student; do?
  10. Q10. Why do functions usually take a pointer to a large struct, like void show(const struct Student s), rather than the struct itself?