Question 102Asked in BPSC TRE 1.0 (2023) Computer Science Class 11-12

How do structures and classes in C++ differ?

  1. AStructures by default hide every member whereas classes do not
  2. BIn structures, members are public by default, whereas, in classes, they are private by default
  3. CStructures cannot have private members, whereas classes can have
  4. DMore than one of the above
  5. 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

This is question 102 of BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.