Question 102Asked in BPSC TRE 1.0 (2023) Computer Science Class 11-12
How do structures and classes in C++ differ?
AStructures by default hide every member whereas classes do not
BIn structures, members are public by default, whereas, in classes, they are private by default
CStructures cannot have private members, whereas classes can have
DMore than one of the above
ENone of the above
Show answerHide answer
Correct answer: (D) More than one of the above
Explanation
Note: the answer key gives (D), but only (B) is correct: struct members are public by default and class members are private by default. C++ structures can also have private members, so (C) is false.
From BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper