Fiveable

⌨️AP Computer Science Principles Unit 3 Review

QR code for AP Computer Science Principles practice questions

3.14 Libraries

3.14 Libraries

Written by the Fiveable Content Team • Last updated June 2026
Verified for the 2027 exam
Verified for the 2027 examWritten by the Fiveable Content Team • Last updated June 2026
⌨️AP Computer Science Principles
Unit & Topic Study Guides

AP Computer Science Principles Exam

Pep mascot

A software library is a collection of already written procedures you can pull into your own program instead of coding everything yourself. An API is the specification that tells you how those procedures behave and how to call them correctly, and good documentation is what makes any library or API usable. For AP Computer Science Principles, connect libraries to abstraction, code reuse, and managing complexity.

Why This Matters for the AP Computer Science Principles Exam

Libraries connect to the bigger idea of using abstraction to manage complexity. On the multiple-choice section, you may need to explain why a programmer would use a library, identify what an API does, or recognize that documentation is necessary to use library procedures correctly. On the Create performance task, choosing and using existing code or library procedures is a normal part of building your program, and you are expected to understand what code you call and how it functions. You do not need to memorize any specific library or programming language for the exam, since AP Computer Science Principles is not tied to one language.

Key Takeaways

  • A software library is a collection of already-developed procedures you can reuse in new programs.
  • Existing code can come from internal sources (your own earlier code) or external sources (public libraries).
  • Using libraries simplifies the work of building complex programs because you do not rewrite procedures that already exist.
  • An API is the specification for how the procedures in a library behave and how they can be used.
  • Documentation is necessary to understand what a library or API does and how to call it correctly.
  • Libraries are an example of abstraction: you can use a procedure by knowing what it does, not how it works internally.

How to Use This on the AP Computer Science Principles Exam

MCQ

Expect questions that test the definitions and the reasoning behind libraries.

  • Know the difference: a library holds reusable procedures, while an API is the specification describing how those procedures behave and are used.
  • Be ready to explain why libraries are useful. The strongest answer connects to managing complexity and reusing correct code instead of rewriting it.
  • Remember that existing code segments can come from internal or external sources, not just public libraries.
  • If a question mentions documentation, the key point is that documentation is what lets a programmer understand and correctly use a library or API.

Create Performance Task

When you build your program, you may use existing code or library procedures as part of it. A few things to keep in mind:

  • You should be able to explain how the code you use functions, even if you did not write every procedure yourself.
  • Using a library procedure is a form of abstraction. You call it by knowing what it does, which lets you focus on your own program's logic.

How Importing Looks

Importing is just the way a program brings in already-written code so you can call it. In Python, that often looks like a line at the top of your program:

</>Code
from location import module

The exact syntax depends on the language, and AP Computer Science Principles does not require any specific one. The concept to remember is that importing gives your program access to procedures that live somewhere else.

What a Library Is

A software library contains already-developed procedures that you can use in your own programs. Instead of writing new procedures to do common tasks, you reuse procedures someone already wrote and made available.

There are libraries for almost any task. Here are some Python examples to make the idea concrete (these are applications, not required AP content):

  • Pillow lets you work with images.
  • Matplotlib lets you make 2D graphs and plots.

You can also import some of your own previously written code into a new program. That is the "internal source" idea: reused code does not have to come from a public library.

APIs and Documentation

An Application Program Interface, or API, is the specification for how the procedures in a library behave and can be used. It tells you what each procedure expects and what it does, so the imported procedures can work correctly with the rest of your code.

Both libraries and APIs depend on good documentation. A library is a collection of other people's procedures, so without documentation it would be hard to know how to call them. API documentation explains how the procedures behave and how to use them, which is what keeps the parts of your program communicating correctly.

Common Misconceptions

  • A library and an API are not the same thing. A library is the collection of reusable procedures; an API is the specification that describes how those procedures behave and are used.
  • Reused code does not have to come from the internet or a public package. Your own previously written code counts as an existing code segment too.
  • Using a library is not "cheating" or skipping understanding. You still need to know what the procedures you call do, which is exactly what documentation helps with.
  • There is no single required library or programming language for AP Computer Science Principles. Specific libraries like Pillow or Matplotlib are examples, not required content.
  • Importing a library does not mean you must understand every internal detail of how its procedures work. The point of abstraction is that you can use a procedure based on what it does.

Vocabulary

The following words are mentioned explicitly in the College Board Course and Exam Description for this topic.

Term

Definition

application program interface

Specifications that define how procedures in a library behave and how they can be used in programs.

code segment

A portion of a program consisting of one or more lines of code that performs a specific function.

documentation

Written information that explains the behaviors provided by an API or library and how to use them.

procedure

A named block of reusable code that performs a specific task and can be called multiple times throughout a program.

software library

A collection of pre-written procedures and code that can be reused in creating new programs.

Frequently Asked Questions

What is a library in AP CSP?

A library is a collection of already-written procedures that programmers can use in their own programs instead of writing every procedure from scratch.

What is an API?

An API is the specification that describes how procedures in a library behave, what inputs they expect, and how a programmer can call them correctly.

Why do programmers use libraries?

Libraries manage complexity, save time, reduce repeated work, and let programmers use reliable procedures without needing to know every internal implementation detail.

What role does documentation play with libraries?

Documentation explains what procedures do, what parameters they need, what they return, and any limits or assumptions, so programmers can use a library correctly.

Are libraries an example of abstraction?

Yes. A library lets you use procedures by knowing what they do, while hiding many details about how they work internally.

How are libraries tested on the AP CSP exam?

You may be asked to explain why a library is useful, distinguish libraries from APIs, identify why documentation is needed, or reason about imported reusable code.

Pep mascot
Upgrade your Fiveable account to print any study guide

Download study guides as beautiful PDFs See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Click below to go to billing portal → update your plan → choose Yearly→ and select "Fiveable Share Plan". Only pay the difference

Plan is open to all students, teachers, parents, etc
Pep mascot
Upgrade your Fiveable account to export vocabulary

Download study guides as beautiful PDFs See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Plan is open to all students, teachers, parents, etc
report an error
description

screenshots help us find and fix the issue faster (optional)

add screenshot