Abstraction Concepts Flashcards
7 cards from real APCSP practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Abstraction Concepts flashcards as text
Which of the following is NOT a benefit of using abstractions in programming?
Answer: Eliminating all possible bugs automatically
Abstraction helps manage complexity and reuse code, but it does not automatically eliminate bugs.
The Internet Protocol (IP) is an abstraction that lets applications send data without worrying about the physical network. Which layer of the internet abstraction stack does IP belong to?
Answer: Internet layer
IP operates at the internet (network) layer, abstracting physical routing from applications.
A programmer writes a `Car` object with properties `speed` and `fuel` and a method `accelerate()`. Users of the object call `accelerate()` without knowing the engine physics. This is an example of:
Answer: Object abstraction / encapsulation
Encapsulating data and behavior inside an object and exposing only a method is a form of abstraction.
What does it mean for an abstraction to 'leak'?
Answer: Details that should be hidden become visible and must be handled by the user
A leaky abstraction is one where hidden implementation details surface and the caller must deal with them.
In AP CSP, which of the following best represents a 'high-level' abstraction compared to a 'low-level' one?
Answer: Python code vs. machine code
Python is a high-level abstraction that hides the machine code a computer actually executes.
When a programmer uses a variable name like `totalScore` instead of a memory address, they are using:
Answer: A naming abstraction that hides the physical memory location
Variable names are abstractions over physical memory addresses, making code readable and writable.
Which of the following scenarios demonstrates abstraction being used to solve a problem?
Answer: A programmer calls `displayMap(city)` without knowing how the map is rendered
Calling `displayMap()` without knowing the rendering details is a direct application of abstraction.