Structures, Unions & Enums MCQs

4 MCQs  — Data Types MCQs

Practice Structures, Unions & Enums MCQs with correct answers and explanations. These questions are from the Data Types MCQs section.

What is the size of a union?
Always 8 bytes
At least the size of its largest member (plus any alignment padding), because all members share the same memory
The size of its first member
The sum of all its members' sizes
What is the main advantage of a C++11 enum class over a plain enum?
It uses less memory
It allows floating-point values
Its values can be strings
Its enumerators are scoped and do not implicitly convert to int