Libraries - AP Computer Science Principles
Card 1 of 30
Which library is used for handling file paths in Python?
Which library is used for handling file paths in Python?
Tap to reveal answer
os.path. Cross-platform file and directory path operations.
os.path. Cross-platform file and directory path operations.
← Didn't Know|Knew It →
Identify a library for unit testing in Python.
Identify a library for unit testing in Python.
Tap to reveal answer
unittest. Built-in framework for automated testing of code.
unittest. Built-in framework for automated testing of code.
← Didn't Know|Knew It →
What is the use of the 'sys' library in Python?
What is the use of the 'sys' library in Python?
Tap to reveal answer
To interact with the Python interpreter. Accesses command-line arguments and system functions.
To interact with the Python interpreter. Accesses command-line arguments and system functions.
← Didn't Know|Knew It →
Name a Python library for image processing.
Name a Python library for image processing.
Tap to reveal answer
PIL (Pillow). Handles image formats, filters, and transformations.
PIL (Pillow). Handles image formats, filters, and transformations.
← Didn't Know|Knew It →
What is the use of the 'itertools' library in Python?
What is the use of the 'itertools' library in Python?
Tap to reveal answer
To create iterators for efficient looping. Provides memory-efficient iteration tools and combinations.
To create iterators for efficient looping. Provides memory-efficient iteration tools and combinations.
← Didn't Know|Knew It →
Identify a library for cryptographic operations in Python.
Identify a library for cryptographic operations in Python.
Tap to reveal answer
cryptography. Implements encryption, decryption, and security protocols.
cryptography. Implements encryption, decryption, and security protocols.
← Didn't Know|Knew It →
What is the primary function of the 'collections' library in Python?
What is the primary function of the 'collections' library in Python?
Tap to reveal answer
To provide specialized container datatypes. Includes Counter, deque, and defaultdict containers.
To provide specialized container datatypes. Includes Counter, deque, and defaultdict containers.
← Didn't Know|Knew It →
Name a library for asynchronous programming in Python.
Name a library for asynchronous programming in Python.
Tap to reveal answer
asyncio. Handles concurrent code execution and async/await syntax.
asyncio. Handles concurrent code execution and async/await syntax.
← Didn't Know|Knew It →
Identify the library used for web scraping in Python.
Identify the library used for web scraping in Python.
Tap to reveal answer
BeautifulSoup. Parses HTML and XML for data extraction.
BeautifulSoup. Parses HTML and XML for data extraction.
← Didn't Know|Knew It →
How do you list all functions in a library in Python?
How do you list all functions in a library in Python?
Tap to reveal answer
Use dir(library_name). Built-in function to explore library contents and methods.
Use dir(library_name). Built-in function to explore library contents and methods.
← Didn't Know|Knew It →
Find and correct the error: 'import math from sqrt'
Find and correct the error: 'import math from sqrt'
Tap to reveal answer
Correct: 'from math import sqrt'. Correct syntax places 'from' before library name.
Correct: 'from math import sqrt'. Correct syntax places 'from' before library name.
← Didn't Know|Knew It →
Which function from the 'math' library computes the square root?
Which function from the 'math' library computes the square root?
Tap to reveal answer
sqrt. Calculates the square root of a number.
sqrt. Calculates the square root of a number.
← Didn't Know|Knew It →
Using the 'random' library, how do you generate a random integer?
Using the 'random' library, how do you generate a random integer?
Tap to reveal answer
random.randint(a, b). Returns random integer between a and b inclusive.
random.randint(a, b). Returns random integer between a and b inclusive.
← Didn't Know|Knew It →
How do you import the 'numpy' library with alias 'np'?
How do you import the 'numpy' library with alias 'np'?
Tap to reveal answer
import numpy as np. Creates shorter alias 'np' for easier reference.
import numpy as np. Creates shorter alias 'np' for easier reference.
← Didn't Know|Knew It →
Find and correct the error: 'import pandas pd'
Find and correct the error: 'import pandas pd'
Tap to reveal answer
Correct: 'import pandas as pd'. Missing 'as' keyword for alias assignment.
Correct: 'import pandas as pd'. Missing 'as' keyword for alias assignment.
← Didn't Know|Knew It →
Which library would you use to send HTTP requests in Python?
Which library would you use to send HTTP requests in Python?
Tap to reveal answer
requests. Standard library for web communication and API calls.
requests. Standard library for web communication and API calls.
← Didn't Know|Knew It →
Name the library that provides tools for parallel programming in Python.
Name the library that provides tools for parallel programming in Python.
Tap to reveal answer
multiprocessing. Enables multiple processes to run simultaneously.
multiprocessing. Enables multiple processes to run simultaneously.
← Didn't Know|Knew It →
What is the use of the 'os' library in Python?
What is the use of the 'os' library in Python?
Tap to reveal answer
To interact with the operating system. Provides access to environment variables and system calls.
To interact with the operating system. Provides access to environment variables and system calls.
← Didn't Know|Knew It →
What command lists all installed libraries in a Python environment?
What command lists all installed libraries in a Python environment?
Tap to reveal answer
pip list. Shows all packages installed in current environment.
pip list. Shows all packages installed in current environment.
← Didn't Know|Knew It →
What is a library in computer science?
What is a library in computer science?
Tap to reveal answer
A collection of pre-written code for reuse. Provides ready-made functions to avoid coding from scratch.
A collection of pre-written code for reuse. Provides ready-made functions to avoid coding from scratch.
← Didn't Know|Knew It →
Identify one benefit of using libraries.
Identify one benefit of using libraries.
Tap to reveal answer
Code reuse and reduced development time. Libraries save time by providing pre-built solutions.
Code reuse and reduced development time. Libraries save time by providing pre-built solutions.
← Didn't Know|Knew It →
What is an API in the context of libraries?
What is an API in the context of libraries?
Tap to reveal answer
A set of rules for accessing a library's features. Defines how to interact with the library's functions.
A set of rules for accessing a library's features. Defines how to interact with the library's functions.
← Didn't Know|Knew It →
Which keyword is often used to import libraries in Python?
Which keyword is often used to import libraries in Python?
Tap to reveal answer
import. Standard Python keyword to include external libraries.
import. Standard Python keyword to include external libraries.
← Didn't Know|Knew It →
Name a common Python library for data manipulation.
Name a common Python library for data manipulation.
Tap to reveal answer
pandas. Popular for working with DataFrames and data analysis.
pandas. Popular for working with DataFrames and data analysis.
← Didn't Know|Knew It →
How do libraries help in error reduction?
How do libraries help in error reduction?
Tap to reveal answer
By using well-tested, pre-written code. Pre-tested code reduces bugs and implementation errors.
By using well-tested, pre-written code. Pre-tested code reduces bugs and implementation errors.
← Didn't Know|Knew It →
What does the NumPy library provide?
What does the NumPy library provide?
Tap to reveal answer
Support for large, multi-dimensional arrays and matrices. Essential for numerical computing and scientific calculations.
Support for large, multi-dimensional arrays and matrices. Essential for numerical computing and scientific calculations.
← Didn't Know|Knew It →
Name a library for machine learning in Python.
Name a library for machine learning in Python.
Tap to reveal answer
scikit-learn. Offers tools for classification, regression, and clustering.
scikit-learn. Offers tools for classification, regression, and clustering.
← Didn't Know|Knew It →
How does a library improve code maintenance?
How does a library improve code maintenance?
Tap to reveal answer
By centralizing code updates and bug fixes. Updates in one place benefit all users of the library.
By centralizing code updates and bug fixes. Updates in one place benefit all users of the library.
← Didn't Know|Knew It →
Which library would you use for web development in Python?
Which library would you use for web development in Python?
Tap to reveal answer
Flask or Django. Both are frameworks for building web applications.
Flask or Django. Both are frameworks for building web applications.
← Didn't Know|Knew It →
Identify the library for handling HTTP requests in Python.
Identify the library for handling HTTP requests in Python.
Tap to reveal answer
requests. Simplifies making GET, POST, and other HTTP calls.
requests. Simplifies making GET, POST, and other HTTP calls.
← Didn't Know|Knew It →