Multi Choice Type QuestionWhat is the primary difference between a structure and a union in C?Marks : 1Negative Marks : 0Answer hereStructure allows nested membersUnion allows nested membersStructure does not allows multiple membersUnion allows only one active memberClearPrev
Question
Multi Choice Type QuestionWhat is the primary difference between a structure and a union in C?Marks : 1Negative Marks : 0Answer hereStructure allows nested membersUnion allows nested membersStructure does not allows multiple membersUnion allows only one active memberClearPrev
Solution
The primary difference between a structure and a union in C is that a structure allows multiple members and each member has its own memory allocation. On the other hand, a union allows only one active member at a time, meaning all members of a union share the same memory location. So, the correct answer is "Union allows only one active member".
Similar Questions
Multi Choice Type QuestionWhat determines the size of a union in C?Marks : 1Negative Marks : 0Answer hereThe biggest member in the unionThe sum of the sizes of all membersThe first member in the unionThe last member in the union
What is the key difference between a structure and a union in C?*1 pointA structure can store multiple data types, a union cannotA union can store multiple data types, a structure cannotIn a structure, only one member can be accessed at a timeIn a union, only one member can be accessed at a time
Multi Choice Type QuestionWhat is true regarding the storage allocation for members in structures and unions?Marks : 1Negative Marks : 0Answer hereEach member in a structure shares the same storage locationEach member in a union is assigned a separate storage locationMemory allocated for members in a union is sharedNone of the mentioned options
Multi Choice Type QuestionWhat happens if you initialize more than one member of a union in C?Marks : 1Negative Marks : 0Answer hereIt results in a compilation error.The last member initialized retains its value.All initialized members share the same memory.It is not possible to initialize multiple members.ClearNext
Multi Choice Type QuestionHow many members of a union can contain a value at any given time?Marks : 1Negative Marks : 0Answer hereAll membersOnly one memberTwo membersThree members
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.