AP Computer Science a Flashcards: Impact Of Program Design

Study Impact Of Program Design in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

QUESTION

What is the result of using magic numbers in code?

Tap card or press Space to flip

ANSWER

Decreases code readability and maintainability. Hard-coded values make code difficult to modify.

1 / 24

AP Computer Science a: Class Creation

All flashcards

24 cards

What this deck covers

This deck focuses on Impact Of Program Design, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

Practice questions

1 of 22Practice questions for this set
A bank is revising its Online Banking Application after an audit found inconsistent balance changes across features. The redesign emphasizes encapsulation using three classes: BankAccount, Transaction, and CustomerProfile. BankAccount stores balance as a private field and exposes deposit and withdraw methods that validate amounts and create a Transaction record for every change. CustomerProfile holds customer information and a list of accounts, but it cannot edit balances directly; it must call account methods. A separate TransferService moves money by calling withdraw on one BankAccount and deposit on another, relying on the built-in validation. The team also adds SavingsAccount extends BankAccount with a minimumBalance rule, overriding withdraw to block withdrawals that break the rule. This keeps account-specific constraints close to the account type. Readability improves because balance changes happen in one place, and maintainability improves because new rules are added by editing BankAccount or a subclass, not every feature. The team accepts a slight performance cost from extra method calls because it prevents invalid balance updates that would be expensive to fix later. Considering the class design, in the scenario, how does encapsulation improve data security?
Choose an answer

Keep your progress across every deck

Free account · cards you mark are saved to it