AP Computer Science Principles Flashcards: Libraries

Study Libraries in AP Computer Science Principles with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

AP Computer Science Principles

Libraries

0 mastered0 still learning

0% Complete

QUESTION
1/ 80

What is a library in computer science?

Tap card or press Space to flip

ANSWER

A collection of pre-written code for reuse. Provides ready-made functions to avoid coding from scratch.

How well did you know it?

Card 1 / 80

What this deck covers

This deck focuses on Libraries, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

All flashcards

Flashcard 1: What is a library in computer science?

Answer: A collection of pre-written code for reuse. Provides ready-made functions to avoid coding from scratch.

Flashcard 2: Identify a library for cryptographic operations in Python.

Answer: cryptography. Implements encryption, decryption, and security protocols.

Flashcard 3: Identify the library typically used for data visualization in Python.

Answer: matplotlib. Creates charts, plots, and graphs for data analysis.

Flashcard 4: Name a Python library for image processing.

Answer: PIL (Pillow). Handles image formats, filters, and transformations.

Flashcard 5: Which library would you use to send HTTP requests in Python?

Answer: requests. Standard library for web communication and API calls.

Flashcard 6: Find and correct the error: 'import math from sqrt'

Answer: Correct: 'from math import sqrt'. Correct syntax places 'from' before library name.

Flashcard 7: What is the use of the 'sys' library in Python?

Answer: To interact with the Python interpreter. Accesses command-line arguments and system functions.

Flashcard 8: Find and correct the error: 'import math from sqrt'

Answer: Correct: 'from math import sqrt'. Correct syntax places 'from' before library name.

Flashcard 9: What is the use of the 'os' library in Python?

Answer: To interact with the operating system. Provides access to environment variables and system calls.

Flashcard 10: What is the use of the 'itertools' library in Python?

Answer: To create iterators for efficient looping. Provides memory-efficient iteration tools and combinations.

Flashcard 11: What command lists all installed libraries in a Python environment?

Answer: pip list. Shows all packages installed in current environment.

Flashcard 12: How does a library improve code maintenance?

Answer: By centralizing code updates and bug fixes. Updates in one place benefit all users of the library.

Flashcard 13: What does the NumPy library provide?

Answer: Support for large, multi-dimensional arrays and matrices. Essential for numerical computing and scientific calculations.

Flashcard 14: Identify the library used for web scraping in Python.

Answer: BeautifulSoup. Parses HTML and XML for data extraction.

Flashcard 15: Name a library that supports regular expressions in Python.

Answer: re. Enables pattern matching and text processing.

Flashcard 16: Name the library that provides tools for parallel programming in Python.

Answer: multiprocessing. Enables multiple processes to run simultaneously.

Flashcard 17: Which library would you use for web development in Python?

Answer: Flask or Django. Both are frameworks for building web applications.

Flashcard 18: Identify a library for working with dates and times in Python.

Answer: datetime. Manages date objects, time zones, and formatting.

Flashcard 19: Identify the library used for web scraping in Python.

Answer: BeautifulSoup. Parses HTML and XML for data extraction.

Flashcard 20: Which library is used for creating plots in Python?

Answer: matplotlib. Standard library for 2D plotting and visualization.

Flashcard 21: Which library would you use to send HTTP requests in Python?

Answer: requests. Standard library for web communication and API calls.

Flashcard 22: Which function from the 'math' library computes the square root?

Answer: sqrt. Calculates the square root of a number.

Flashcard 23: Which library is commonly used for scientific computing in Python?

Answer: SciPy. Built on NumPy for advanced mathematical operations.

Flashcard 24: Name a library for machine learning in Python.

Answer: scikit-learn. Offers tools for classification, regression, and clustering.

Flashcard 25: What is the use of the 'itertools' library in Python?

Answer: To create iterators for efficient looping. Provides memory-efficient iteration tools and combinations.

Flashcard 26: Name a library used for creating graphical user interfaces in Python.

Answer: Tkinter. Built-in Python library for desktop application interfaces.

Flashcard 27: Identify the library for handling HTTP requests in Python.

Answer: requests. Simplifies making GET, POST, and other HTTP calls.

Flashcard 28: What is the primary use of the 'random' library in Python?

Answer: To generate random numbers. Provides functions for random selection and probability.

Flashcard 29: Which Python library is used for mathematical operations?

Answer: math. Provides functions like sqrt, sin, cos, and pi.

Flashcard 30: Find and correct the error: 'import pandas pd'

Answer: Correct: 'import pandas as pd'. Missing 'as' keyword for alias assignment.

Flashcard 31: What is the primary function of the 'collections' library in Python?

Answer: To provide specialized container datatypes. Includes Counter, deque, and defaultdict containers.

Flashcard 32: Name the library that provides tools for parallel programming in Python.

Answer: multiprocessing. Enables multiple processes to run simultaneously.

Flashcard 33: Identify one benefit of using libraries.

Answer: Code reuse and reduced development time. Libraries save time by providing pre-built solutions.

Flashcard 34: Which library is commonly used for scientific computing in Python?

Answer: SciPy. Built on NumPy for advanced mathematical operations.

Flashcard 35: Using the 'random' library, how do you generate a random integer?

Answer: random.randint(a, b). Returns random integer between a and b inclusive.

Flashcard 36: How do you list all functions in a library in Python?

Answer: Use dir(library_name). Built-in function to explore library contents and methods.

Flashcard 37: What is an API in the context of libraries?

Answer: A set of rules for accessing a library's features. Defines how to interact with the library's functions.

Flashcard 38: Name a library for asynchronous programming in Python.

Answer: asyncio. Handles concurrent code execution and async/await syntax.

Flashcard 39: Identify a library for working with dates and times in Python.

Answer: datetime. Manages date objects, time zones, and formatting.

Flashcard 40: How do libraries help in error reduction?

Answer: By using well-tested, pre-written code. Pre-tested code reduces bugs and implementation errors.

Flashcard 41: What is the primary function of the 'collections' library in Python?

Answer: To provide specialized container datatypes. Includes Counter, deque, and defaultdict containers.

Flashcard 42: What is an API in the context of libraries?

Answer: A set of rules for accessing a library's features. Defines how to interact with the library's functions.

Flashcard 43: Identify the library typically used for data visualization in Python.

Answer: matplotlib. Creates charts, plots, and graphs for data analysis.

Flashcard 44: Which keyword is often used to import libraries in Python?

Answer: import. Standard Python keyword to include external libraries.

Flashcard 45: Identify one benefit of using libraries.

Answer: Code reuse and reduced development time. Libraries save time by providing pre-built solutions.

Flashcard 46: What is the primary use of the 'random' library in Python?

Answer: To generate random numbers. Provides functions for random selection and probability.

Flashcard 47: Name a library for machine learning in Python.

Answer: scikit-learn. Offers tools for classification, regression, and clustering.

Flashcard 48: Identify the library for handling HTTP requests in Python.

Answer: requests. Simplifies making GET, POST, and other HTTP calls.

Flashcard 49: Find and correct the error: 'import pandas pd'

Answer: Correct: 'import pandas as pd'. Missing 'as' keyword for alias assignment.

Flashcard 50: Name a library used for creating graphical user interfaces in Python.

Answer: Tkinter. Built-in Python library for desktop application interfaces.

Flashcard 51: Which Python library is used for mathematical operations?

Answer: math. Provides functions like sqrt, sin, cos, and pi.

Flashcard 52: What command lists all installed libraries in a Python environment?

Answer: pip list. Shows all packages installed in current environment.

Flashcard 53: Identify a library for unit testing in Python.

Answer: unittest. Built-in framework for automated testing of code.

Flashcard 54: What is the use of the 'shutil' library in Python?

Answer: To perform high-level file operations. Includes copying, moving, and archiving files.

Flashcard 55: What is the use of the 'os' library in Python?

Answer: To interact with the operating system. Provides access to environment variables and system calls.

Flashcard 56: What library would you use to parse JSON data in Python?

Answer: json. Handles JavaScript Object Notation data format.

Flashcard 57: Which library is used for handling file paths in Python?

Answer: os.path. Cross-platform file and directory path operations.

Flashcard 58: What library would you use to parse JSON data in Python?

Answer: json. Handles JavaScript Object Notation data format.

Flashcard 59: Name a common Python library for data manipulation.

Answer: pandas. Popular for working with DataFrames and data analysis.

Flashcard 60: Name a common Python library for data manipulation.

Answer: pandas. Popular for working with DataFrames and data analysis.

Flashcard 61: Name a library for asynchronous programming in Python.

Answer: asyncio. Handles concurrent code execution and async/await syntax.

Flashcard 62: Name a library that supports regular expressions in Python.

Answer: re. Enables pattern matching and text processing.

Flashcard 63: Which library is used for handling file paths in Python?

Answer: os.path. Cross-platform file and directory path operations.

Flashcard 64: Name a Python library for image processing.

Answer: PIL (Pillow). Handles image formats, filters, and transformations.

Flashcard 65: Which function from the 'math' library computes the square root?

Answer: sqrt. Calculates the square root of a number.

Flashcard 66: Which library would you use for web development in Python?

Answer: Flask or Django. Both are frameworks for building web applications.

Flashcard 67: What is the use of the 'sys' library in Python?

Answer: To interact with the Python interpreter. Accesses command-line arguments and system functions.

Flashcard 68: How do you import the 'numpy' library with alias 'np'?

Answer: import numpy as np. Creates shorter alias 'np' for easier reference.

Flashcard 69: What is the use of the 'shutil' library in Python?

Answer: To perform high-level file operations. Includes copying, moving, and archiving files.

Flashcard 70: How do you import the 'numpy' library with alias 'np'?

Answer: import numpy as np. Creates shorter alias 'np' for easier reference.

Flashcard 71: How do you list all functions in a library in Python?

Answer: Use dir(library_name). Built-in function to explore library contents and methods.

Flashcard 72: Using the 'random' library, how do you generate a random integer?

Answer: random.randint(a, b). Returns random integer between a and b inclusive.

Flashcard 73: What is a library in computer science?

Answer: A collection of pre-written code for reuse. Provides ready-made functions to avoid coding from scratch.

Flashcard 74: What does the NumPy library provide?

Answer: Support for large, multi-dimensional arrays and matrices. Essential for numerical computing and scientific calculations.

Flashcard 75: Which keyword is often used to import libraries in Python?

Answer: import. Standard Python keyword to include external libraries.

Flashcard 76: How do libraries help in error reduction?

Answer: By using well-tested, pre-written code. Pre-tested code reduces bugs and implementation errors.

Flashcard 77: Identify a library for cryptographic operations in Python.

Answer: cryptography. Implements encryption, decryption, and security protocols.

Flashcard 78: How does a library improve code maintenance?

Answer: By centralizing code updates and bug fixes. Updates in one place benefit all users of the library.

Flashcard 79: Which library is used for creating plots in Python?

Answer: matplotlib. Standard library for 2D plotting and visualization.

Flashcard 80: Identify a library for unit testing in Python.

Answer: unittest. Built-in framework for automated testing of code.