--:--









Quiz for Difference between structures and unions

Course: C Language | Subject: Unit 7 | Topic: Structures and Unions



Logo

Q1: What is the key difference between a structure and a union?

Logo

Q2: In terms of memory size, how does a struct compare to a union?

Logo

Q3: Can both structs and unions have nested members?

Logo

Q4: How are members accessed in struct and union?

Logo

Q5: Which allows all members to store different values simultaneously?

Logo

Q6: Which data type is typically used for memory-efficient storage?

Logo

Q7: Which allows type punning and accessing the same memory as different types?

Logo

Q8: When you assign values to multiple members, which retains only last assigned value?

Logo

Q9: How does alignment affect structs and unions?

Logo

Q10: Can both structs and unions have bit-fields?

Logo

Q11: Which can be initialized at declaration with multiple members?

Logo

Q12: Are pointers to structs and unions used differently?

Logo

Q13: Which allows storing multiple members' values at the same time?

Logo

Q14: How do you define a struct with alias "Person"?

Logo

Q15: What happens to union members when you assign to one member?

Logo

Q16: Which is preferred when data members are mutually exclusive?

Logo

Q17: How is the memory layout different for struct vs union?

Logo

Q18: Is it possible to use sizeof operator on struct and union?

Logo

Q19: Which keyword is used for both struct and union definitions?

Logo

Q20: Can structs and unions be used in function parameters?

Are you ready to start test? Set your time limit