AP Computer Science Principles Practice Quiz: Libraries
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Test your understanding with short quizzes. This quiz has 12 questions to check your progress.
Question 1 of 12
All Questions (12)
A) A collection of complete programs
B) User interface design templates
C) Procedures that may be used in creating new programs
D) Specifications for hardware
Correct Answer: C
The content explicitly states, 'A software library contains procedures that may be used in creating new programs.'
A) It guarantees the program will have no errors.
B) It simplifies the task of creating complex programs.
C) It reduces the need for the programmer to write any original code.
D) It ensures the program runs on any operating system.
Correct Answer: B
The text states, 'The use of libraries simplifies the task of creating complex programs.' This is the main advantage mentioned.
A) It is the actual executable code of the library.
B) It is a tool for testing the performance of a library.
C) It provides specifications for how library procedures behave and can be used.
D) It is a forum for developers to discuss the library.
Correct Answer: C
The content defines APIs as 'specifications for how the procedures in a library behave and can be used.'
A) The documentation for the API/library
B) A different library with similar functionality
C) The source code of their own program
D) An online code compiler
Correct Answer: A
The text states, 'Documentation for an API/library is necessary in understanding the behaviors provided by the API/library and how to use them.' This documentation would explain the required arguments.
A) Only from external sources
B) Only from previously written code by the same programmer
C) From internal or external sources
D) Only from the computer's operating system
Correct Answer: C
The provided content mentions that 'Existing code segments can come from internal or external sources, such as libraries or previously written code.'
A) Creating a new Application Program Interface (API)
B) Writing documentation for a new program
C) Selecting an appropriate library to use in creating a new program
D) Relying only on internal sources for code
Correct Answer: C
This scenario directly illustrates the first point of the provided content: 'Select appropriate libraries or existing code segments to use in creating new programs.'
A) The API is a list of bugs found in the library's procedures.
B) The library contains procedures, and the API describes how to use them.
C) The API is a more complex version of the library's procedures.
D) The library is the documentation, and the API is the collection of procedures.
Correct Answer: B
The content states that a library contains procedures and that an API provides the specifications for how those procedures can be used. Therefore, the API describes how to use the library's procedures.
A) An external library
B) An Application Program Interface (API)
C) An existing code segment from an internal source
D) API documentation
Correct Answer: C
The text states that existing code can come from 'internal or external sources, such as libraries or previously written code.' Code written by the same programmer for a past project is an internal source.
A) The documentation contains the source code, which must be manually copied.
B) Without documentation, the developer cannot understand the behaviors of the library's procedures or how to use them.
C) The documentation is required by the compiler to link the library to the new program.
D) The documentation provides the only way to purchase a license for the library.
Correct Answer: B
This is a direct application of the final point: 'Documentation for an API/library is necessary in understanding the behaviors provided by the API/library and how to use them.'
A) create API specifications.
B) replace the need for documentation.
C) serve as an internal source of code.
D) simplify the task of creating complex programs.
Correct Answer: D
The scenario of avoiding writing thousands of lines of complex code is a clear example of how 'The use of libraries simplifies the task of creating complex programs.'
A) The Application Program Interface (API)
B) The library's file name
C) The programmer's previously written code
D) The software's end-user license agreement
Correct Answer: A
The content explicitly states that 'Application program interfaces (APIs) are specifications for how the procedures in a library behave and can be used,' which are the 'rules' for interaction.
A) Rewrite the library's documentation.
B) Select appropriate libraries or code segments.
C) Ensure the library was written in the same year.
D) Use only internal code sources.
Correct Answer: B
The first point of the provided content is a key skill for a programmer: 'Select appropriate libraries or existing code segments to use in creating new programs.'