AP CSA 3.2 Exercise 2: Impact of Program Design Applied Practice

Unit 3: Class Creation · Lesson 3.2 · Exercise 2

Impact of Program Design: Applied Practice

Six scenarios on what a design decision costs later, once other code depends on it.

How this one is different

These six are about consequences: what breaks for callers, what a change ripples into, and why some decisions are much harder to reverse than others.

Applied Practice

6 questions · scenario driven · every answer is recorded for your teacher

Question 1 of 6Analyze
A public method's parameter list is changed after twenty other classes already call it.
What is the consequence?
Incorrect. The callers are the ones that break.
Incorrect. A signature mismatch is caught at compile time, which is the good case.
Incorrect. No such automatic update exists.
Correct. Correct, and it is the practical reason to keep as much as possible private.
Question 2 of 6Evaluate
A class stores a temperature in Fahrenheit but exposes only getCelsius and setCelsius.
What flexibility does that preserve?
Incorrect. Speed is unaffected.
Incorrect. The opposite: hiding the field is what keeps it changeable.
Correct. Correct. This is why accessors beat public fields even when they look like pure overhead.
Incorrect. That is precisely what the design prevents.
Question 3 of 6Apply
A method returns a reference to the class's internal ArrayList.
What has been given away?
Incorrect. A reference carries every method the object has, including the mutating ones.
Correct. Correct. This is the leak that makes encapsulation look present while being absent.
Incorrect. Returning the field returns the reference, not a copy.
Incorrect. Nothing about returning it restricts modification.
Question 4 of 6Analyze
Two classes each hold a reference to the other and call each other's methods freely.
What is the design cost?
Correct. Correct. Tight bidirectional coupling is what makes a codebase hard to change.
Incorrect. Mutual references compile fine.
Incorrect. Two references are negligible.
Incorrect. It is legal but it is a known design smell.
Question 5 of 6Apply
A constructor performs heavy work such as reading files and contacting a network.
Why is that a questionable design?
Incorrect. Constructors can throw.
Incorrect. Memory is not the concern.
Incorrect. Constructors may contain logic; the question is how much.
Correct. Correct. Construction is expected to be cheap, and coupling it to I/O removes the caller's choice.
Question 6 of 6Evaluate
A programmer wants to add a field to a class that is already used across a large project.
Why is adding a private field usually low risk?
Incorrect. Recompilation is not what makes it safe.
Incorrect. It is compiled normally.
Correct. Correct, and the contrast with changing a PUBLIC signature is the point of the topic.
Incorrect. It can certainly introduce bugs inside the class.

Where to go next

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]