All flashcards
Flashcard 1: Which library is used for handling file paths in Python?
Answer: os.path. Cross-platform file and directory path operations.
Flashcard 2: Identify a library for unit testing in Python.
Answer: unittest. Built-in framework for automated testing of code.
Flashcard 3: 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 4: Name a Python library for image processing.
Answer: PIL (Pillow). Handles image formats, filters, and transformations.
Flashcard 5: 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 6: Identify a library for cryptographic operations in Python.
Answer: cryptography. Implements encryption, decryption, and security protocols.
Flashcard 7: What is the primary function of the 'collections' library in Python?
Answer: To provide specialized container datatypes. Includes Counter, deque, and defaultdict containers.
Flashcard 8: Name a library for asynchronous programming in Python.
Answer: asyncio. Handles concurrent code execution and async/await syntax.
Flashcard 9: Identify the library used for web scraping in Python.
Answer: BeautifulSoup. Parses HTML and XML for data extraction.
Flashcard 10: 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 11: Find and correct the error: 'import math from sqrt'
Answer: Correct: 'from math import sqrt'. Correct syntax places 'from' before library name.
Flashcard 12: Which function from the 'math' library computes the square root?
Answer: sqrt. Calculates the square root of a number.
Flashcard 13: 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 14: How do you import the 'numpy' library with alias 'np'?
Answer: import numpy as np. Creates shorter alias 'np' for easier reference.
Flashcard 15: Find and correct the error: 'import pandas pd'
Answer: Correct: 'import pandas as pd'. Missing 'as' keyword for alias assignment.
Flashcard 16: Which library would you use to send HTTP requests in Python?
Answer: requests. Standard library for web communication and API calls.
Flashcard 17: Name the library that provides tools for parallel programming in Python.
Answer: multiprocessing. Enables multiple processes to run simultaneously.
Flashcard 18: 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 19: What command lists all installed libraries in a Python environment?
Answer: pip list. Shows all packages installed in current environment.
Flashcard 20: 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 21: Identify one benefit of using libraries.
Answer: Code reuse and reduced development time. Libraries save time by providing pre-built solutions.
Flashcard 22: 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 23: Which keyword is often used to import libraries in Python?
Answer: import. Standard Python keyword to include external libraries.
Flashcard 24: Name a common Python library for data manipulation.
Answer: pandas. Popular for working with DataFrames and data analysis.
Flashcard 25: How do libraries help in error reduction?
Answer: By using well-tested, pre-written code. Pre-tested code reduces bugs and implementation errors.
Flashcard 26: What does the NumPy library provide?
Answer: Support for large, multi-dimensional arrays and matrices. Essential for numerical computing and scientific calculations.
Flashcard 27: Name a library for machine learning in Python.
Answer: scikit-learn. Offers tools for classification, regression, and clustering.
Flashcard 28: 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 29: Which library would you use for web development in Python?
Answer: Flask or Django. Both are frameworks for building web applications.
Flashcard 30: Identify the library for handling HTTP requests in Python.
Answer: requests. Simplifies making GET, POST, and other HTTP calls.