Multiple choice technology programming languages

Which of the following are true statements?

  1. A top-level class can not be called "tightly encapsulated" unless it is declared private.

  2. Encapsulation enhances the maintainability of the code.

  3. A tightly encapsulated class allows fast public access to member fields.

  4. A tightly encapsulated class allows access to data only through accessor and mutator methods.

  5. Encapsulation usually reduces the size of the code.

  6. A tightly encapsulated class might have mutator methods that validate data before it is loaded into the internal data model.

Reveal answer Fill a bubble to check yourself
B,D,F Correct answer
Explanation

Encapsulation improves maintainability (B). A tightly encapsulated class restricts field access to getters/setters (D). Mutators can validate data (F). Tightly encapsulated classes need not be private (A), don't need fast public access (C), and don't necessarily reduce code size (E).