AP Computer Science A Practice Quiz: Application Program Interface (API) and Libraries
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Test your understanding with short quizzes. This quiz has 9 questions to check your progress.
Question 1 of 9
All Questions (9)
A) A collection of classes.
B) A specification that informs a programmer how to use classes.
C) The data related to a specific class.
D) The actions that an instance of a class can perform.
Correct Answer: A
The content explicitly states, 'Libraries are collections of classes.' The other options describe an API, attributes, and behaviors, respectively.
A) To store the data and variables for a class.
B) To group multiple classes into a single collection.
C) To define what an instance of a class can do.
D) To inform the programmer how to use the classes within a library.
Correct Answer: D
The text states, 'An application programming interface (API) specification informs the programmer how to use those classes.' Its purpose is to provide documentation and instructions.
A) The actions or functions the class can perform.
B) The collection of classes the class belongs to.
C) The data related to the class, which are stored in variables.
D) The documentation explaining how to use the class.
Correct Answer: C
The content defines attributes as 'the data related to the class and are stored in variables.' Option A describes behaviors.
A) An attribute
B) A behavior
C) A library
D) An API
Correct Answer: B
Behaviors refer to what instances of the class can do. 'withdrawFunds()' is an action or something that can be done with a BankAccount instance, so it is a behavior defined by a method.
A) By creating their own classes from scratch.
B) By consulting the documentation found in the API specification.
C) By examining the variables in their own program.
D) By combining multiple libraries into one.
Correct Answer: B
The text explicitly states that 'Documentation found in API specifications and libraries is essential to understanding the attributes and behaviors of a class defined by the API.'
A) Other methods
B) APIs
C) Libraries
D) Variables
Correct Answer: D
The content directly links these concepts: 'Attributes refer to the data related to the class and are stored in variables. Behaviors... are defined by methods.'
A) Behaviors
B) Methods
C) Attributes
D) API
Correct Answer: C
'title' and 'author' are data related to the 'Book' class. According to the definition, data related to a class are its attributes.
A) An API is a collection of classes, and a library defines their attributes and behaviors.
B) A library is a collection of classes, and an API's documentation explains the attributes (data) and behaviors (methods) of those classes.
C) A class is a collection of libraries, and an API specifies how to use the class.
D) Attributes and behaviors are types of libraries that are explained by an API.
Correct Answer: B
This option correctly identifies that libraries contain classes and that the API documentation is the key to understanding the attributes (data/variables) and behaviors (actions/methods) of those classes.
A) Attributes
B) Variables
C) Behaviors
D) Libraries
Correct Answer: C
The provided text defines behaviors as 'what instances of the class can do (or what can be done with them) and are defined by methods.' Attributes and variables refer to data.