AP CSP Day 39: Network Architecture
Share
Practice Question
A programmer creates two versions of a GPA calculator:
Version 1: All calculation logic is written directly in the main program. Version 2: The calculation is placed in a procedure called calculateGPA that takes a list of grades and returns the GPA.
Which of the following are advantages of Version 2?
I. The GPA calculation can be reused elsewhere without duplicating code.
II. The main program is easier to read because calculation details are hidden.
III. Version 2 will always compute a more accurate GPA than Version 1.
I is correct: procedures enable code reuse without duplication. II is correct: moving details into a named procedure makes the main program more readable through abstraction. III is false: both versions can implement the same formula with identical accuracy. Abstraction affects organization, not mathematical correctness.
B) Statement II is also a valid advantage, not just statement I. C) Statement III is false — abstraction does not inherently improve calculation accuracy. D) Statement III is false, so "all three" is incorrect.
Students conflate better code organization with better computational results. Procedural abstraction improves readability, maintainability, and reusability — not output accuracy.
For I/II/III format questions, evaluate each statement independently. Do not assume that if two are true, the third must also be true.
Keep Practicing!
Consistent daily practice is the key to AP CSP success.
AP CSP Resources Get 1-on-1 Help