PrepGo

AP Computer Science Principles Flashcards: Developing Procedures

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Review key ideas with interactive flashcards. This set includes 24 cards to help you master important concepts.

What is the primary benefit of extracting shared features into a procedure?
It generalizes functionality, which prevents code duplication and allows the procedure to be reused, helping to manage complexity.
Card 1 of 24

All Flashcards (24)

What is the primary benefit of extracting shared features into a procedure?
It generalizes functionality, which prevents code duplication and allows the procedure to be reused, helping to manage complexity.
What is procedural abstraction?
Procedural abstraction provides a name for a process and allows a procedure to be used knowing only what it does, not how it does it.
What is modularity in programming?
Modularity is the subdivision of a computer program into separate subprograms, such as procedures.
How does procedural abstraction manage complexity in a program?
It allows a solution to a large problem to be based on the solutions of smaller subproblems, each handled by a separate procedure.
What two types of procedure definitions are provided on the exam reference sheet?
The sheet provides a structure for procedures that perform actions and one for procedures that return a value.
How does using procedural abstraction affect code readability?
Using procedural abstraction helps improve code readability by giving descriptive names to complex processes.
Define 'code reuse'.
Code reuse is the practice of using existing code, such as a procedure, in multiple places within a program or in new programs.
How does modularity contribute to managing complexity?
By breaking a large program into smaller, independent subprograms (modules), it becomes easier to develop, test, and maintain each part separately.
How do parameters make procedures more useful?
Using parameters allows procedures to be generalized so they can be reused with a range of different input values or arguments.
What is the advantage of being able to change a procedure's internal logic?
It allows for improvements, such as enhanced performance, without affecting other parts of the program that use the procedure.
If you have two sections of code that perform a similar task, what is the best way to refactor this using procedural abstraction?
You should extract the shared features into a single, generalized procedure with parameters to handle any differences.
How are procedures related to subproblems?
Procedures are created to provide solutions for smaller subproblems, which are then combined to solve a larger problem.
Why is it beneficial to use a procedure without knowing how it works internally?
This is a core principle of abstraction that manages complexity; you only need to know what the procedure does to use it effectively.
What is the function of the RETURN statement in a procedure?
The RETURN statement causes an immediate return from the procedure and sends a value back to where the procedure was called.
If a programmer improves the performance of a procedure, what must be preserved for the change to be seamless?
The stated function of the procedure must be preserved, ensuring that what the procedure does remains the same for its users.
What is the relationship between procedural abstraction and code maintenance?
Procedural abstraction simplifies maintenance because an update or bug fix only needs to be applied to the single procedure, not every place the code was used.
A programmer writes a `calculateArea` procedure. According to procedural abstraction, what does another programmer need to know to use it?
They only need to know the procedure's name and what inputs (arguments) it requires, not the specific mathematical formula used inside.
When breaking down a large problem, what is the goal of creating procedures for each subproblem?
The goal is to solve each small, manageable part correctly, and then combine these procedures to form a complete solution to the large problem.
Explain the concept of 'hiding complexity' in the context of procedures.
Procedural abstraction hides the complex details of an implementation inside the procedure, presenting a simple interface to the user.
What problem does generalizing procedures with shared features help to avoid?
It helps to avoid code duplication, where the same lines of code are repeated in multiple places in a program.
Why would a procedure be designed to return a value?
A procedure returns a value when the result of its computation is needed in the part of the program that called it.
What is the main method for developing procedural abstractions in a program?
The main method is to develop procedural abstractions by writing procedures for specific processes.
According to the exam reference sheet, what does the PROCEDURE definition structure describe?
It describes how to define a procedure that takes zero or more arguments and contains a block of statements.
What is an argument in the context of a procedure?
An argument is an input value passed to a procedure when it is called, allowing for generalized and reusable code.