๐ŸŒ Python Programming ยท subject

Python Programming Advanced Topics and Applied Libraries Syllabus

The Advanced Topics and Applied Libraries syllabus for Python Programming in full: 6 chapters and 24 topics, every one listed below, plus 55 Advanced Topics and Applied Libraries flashcards with answers.

6Chapters
24Topics
55Flashcards

Advanced Topics and Applied Libraries syllabus: all 6 chapters

Expand any chapter to see its topics and sub-topics.

  1. Working with Data Formats

    4 topics
    • JSON Processing
    • CSV Files
    • XML Parsing with ElementTree
    • Regular Expressions with re
  2. Concurrency and Parallelism

    4 topics
    • Threading
    • Multiprocessing
    • Asynchronous Programming
    • The Global Interpreter Lock (GIL)
  3. Testing and Debugging

    4 topics
    • Unit Testing with unittest
    • Testing with pytest
    • Debugging with pdb
    • Logging
  4. Network and Web Programming

    4 topics
    • Socket Programming
    • HTTP Requests
    • Web Frameworks Overview
    • REST APIs
  5. Data Science and Numerical Libraries

    4 topics
    • NumPy Arrays
    • Data Analysis with Pandas
    • Data Visualization with Matplotlib
    • Introduction to Machine Learning Libraries
  6. Type Hints and Modern Python

    4 topics
    • Type Annotations and the typing Module
    • Static Type Checking with mypy
    • Structural Pattern Matching
    • Walrus Operator and Recent Features

Python Programming Advanced Topics and Applied Libraries flashcards โ€” 55 questions with answers

  1. Which Python standard-library module is used to encode Python objects to JSON strings and decode JSON back to Python objects?

    The json module.

  2. What is the difference between json.dumps() and json.dump()?

    json.dumps() returns a JSON-formatted string; json.dump() writes the JSON output directly to a file-like object.

  3. What is the difference between json.loads() and json.load()?

    json.loads() parses a JSON string into a Python object; json.load() reads and parses JSON from a file-like object.

  4. How does Python's json module map JSON types to Python types when decoding (object, array, true/false, null)?

    JSON object โ†’ dict, array โ†’ list, string โ†’ str, number โ†’ int/float, true/false โ†’ True/False, null โ†’ None.

  5. Which json.dumps() argument pretty-prints the output with indentation, and what does sort_keys do?

    indent (e.g. indent=4) adds indentation for readability; sort_keys=True sorts dictionary keys alphabetically in the output.

  6. In the csv module, what is the difference between csv.reader and csv.DictReader?

    csv.reader yields each row as a list of strings; csv.DictReader yields each row as a dict keyed by the header (first) row's field names.

  7. When opening a file for use with the csv module, what argument should you pass to open() to avoid extra blank lines, and why?

    Pass newline='' so the csv module handles line endings itself and does not insert blank rows on some platforms (e.g. Windows).

  8. Which csv writer methods write a single row versus multiple rows at once?

    writerow() writes one row (a sequence); writerows() writes multiple rows (an iterable of sequences).

  9. In the csv module, what does the delimiter parameter control, and what is its default?

    delimiter sets the character separating fields; the default is a comma (',').

  10. Which standard-library module parses XML using the ElementTree API, and what are the two core object types it works with?

    xml.etree.ElementTree; it works with the ElementTree (whole document) and Element (individual nodes) objects.

  11. In ElementTree, how do you parse an XML file and obtain the root element?

    tree = ET.parse('file.xml') then root = tree.getroot() (or use ET.fromstring(text) to parse a string, which returns the root directly).

  12. For an ElementTree Element, what do .tag, .attrib, and .text represent?

    .tag is the element's name, .attrib is a dict of its attributes, and .text is the text content between its opening and closing tags.

  13. In ElementTree, what is the difference between element.find() and element.findall()?

    find() returns the first matching sub-element (or None); findall() returns a list of all matching direct sub-elements.

  14. Which Python module provides regular-expression support, and what is the benefit of using raw strings for patterns?

    The re module; raw strings (r'...') prevent Python from interpreting backslashes, so regex escapes like \d are passed to the engine intact.

  15. In the re module, what is the difference between re.match() and re.search()?

    re.match() checks for a match only at the beginning of the string; re.search() scans the whole string for the first match anywhere.

  16. What does re.findall() return versus re.finditer()?

    re.findall() returns a list of all matching substrings (or tuples of groups); re.finditer() returns an iterator of match objects.

  17. In regex, what do the metacharacters \d, \w, and \s match?

    \d matches any digit, \w matches any word character (letter, digit, or underscore), and \s matches any whitespace character.

  18. In regex quantifiers, what do *, +, and ? mean?

    * matches 0 or more of the preceding element, + matches 1 or more, and ? matches 0 or 1 (optional).

  19. What is the difference between a greedy quantifier and a lazy (non-greedy) quantifier in regex?

    Greedy quantifiers (e.g. .*) match as much as possible; adding ? makes them lazy (e.g. .*?), matching as little as possible.

  20. Which class do you use to create a thread in Python's threading module, and which method starts it running concurrently?

    threading.Thread; call .start() to begin execution (which invokes run() in a new thread), and .join() to wait for it to finish.

Show the other 35 Advanced Topics and Applied Libraries flashcards
  1. What is the purpose of a threading.Lock, and which methods acquire and release it?

    A Lock provides mutual exclusion to protect shared data from race conditions; acquire() locks it and release() unlocks it (often via a with block).

  2. In Python, why does threading generally not speed up CPU-bound work, but can help I/O-bound work?

    The Global Interpreter Lock allows only one thread to execute Python bytecode at a time, so CPU-bound threads can't run in true parallel; but during blocking I/O the GIL is released, letting other threads run.

  3. Which module lets Python achieve true parallelism across multiple CPU cores by using separate processes, bypassing the GIL?

    The multiprocessing module.

  4. Why does multiprocessing bypass the GIL limitation that affects threading?

    Each process has its own Python interpreter and separate memory space with its own GIL, so processes can run Python bytecode truly in parallel on different cores.

  5. In multiprocessing, what does a Pool provide, and name one common method it offers.

    A Pool manages a group of worker processes to parallelize a task; common methods include map(), apply(), apply_async(), and starmap().

  6. What keywords define and call a coroutine in Python's asynchronous programming model?

    async def defines a coroutine, and await is used to suspend it while awaiting another awaitable (coroutine, Task, or Future).

  7. Which standard-library module provides the event loop for asynchronous programming, and what function runs a coroutine to completion?

    asyncio; asyncio.run(coro) starts the event loop and runs the coroutine to completion.

  8. In asyncio, what is the difference between awaiting coroutines sequentially and using asyncio.gather()?

    Awaiting them one by one runs them in sequence; asyncio.gather() schedules multiple awaitables to run concurrently and waits for all to complete.

  9. What does the acronym GIL stand for, and what is it?

    Global Interpreter Lock โ€” a mutex in CPython that permits only one thread to execute Python bytecode at a time.

  10. Concurrency model comparison: for CPU-bound vs I/O-bound tasks in Python, which is generally preferred โ€” threading, multiprocessing, or asyncio?

    CPU-bound work favors multiprocessing (true parallelism); I/O-bound work favors threading or asyncio (concurrency during waits), with asyncio best for large numbers of I/O operations.

  11. In the unittest framework, which base class do test cases inherit from, and what naming convention must test methods follow?

    Test cases inherit from unittest.TestCase, and each test method's name must start with 'test'.

  12. In unittest, what are the roles of setUp() and tearDown()?

    setUp() runs before each test method to prepare fixtures; tearDown() runs after each test method to clean up.

  13. Name three common unittest assertion methods and what they check.

    assertEqual(a, b) checks a == b; assertTrue(x) checks x is truthy; assertRaises(Exc) checks that the given exception is raised.

  14. How does pytest discover and identify test functions, and how do you assert conditions?

    pytest auto-discovers files named test_*.py or *_test.py and functions prefixed with test_; you use plain Python assert statements for checks.

  15. What is a pytest fixture and how is one defined and used?

    A fixture supplies reusable setup/teardown or test data; you define it with the @pytest.fixture decorator and use it by naming it as a test function's parameter.

  16. Which pytest decorator runs the same test with multiple sets of input values?

    @pytest.mark.parametrize, which supplies argument names and a list of value sets to run the test multiple times.

  17. Which standard-library module is Python's interactive source-code debugger, and what one-line call sets a breakpoint?

    pdb; calling pdb.set_trace() (or the built-in breakpoint() in Python 3.7+) sets a breakpoint at that line.

  18. In pdb, what do the commands n (next), s (step), and c (continue) do?

    n executes the current line without entering functions, s steps into a called function, and c resumes execution until the next breakpoint or program end.

  19. Which standard-library module provides configurable logging, and what function gives you a logger instance?

    The logging module; logging.getLogger(name) returns a logger instance.

  20. List Python logging's five standard severity levels from lowest to highest.

    DEBUG, INFO, WARNING, ERROR, CRITICAL (increasing severity).

  21. What is the default logging level in Python, meaning which messages appear if you don't configure logging?

    WARNING is the default level, so only WARNING, ERROR, and CRITICAL messages are shown by default.

  22. Which module provides low-level networking, and what two arguments to socket.socket() specify TCP versus UDP over IPv4?

    The socket module; socket.socket(socket.AF_INET, socket.SOCK_STREAM) is TCP, and socket.SOCK_DGRAM is UDP.

  23. List the typical sequence of socket calls for a TCP server.

    socket() โ†’ bind((host, port)) โ†’ listen() โ†’ accept() (to get a connection) โ†’ recv()/send() โ†’ close().

  24. Which popular third-party library simplifies making HTTP requests in Python, and how do you send a GET request?

    The requests library; requests.get(url) sends a GET request and returns a Response object.

  25. For a requests Response object, what do .status_code, .text, and .json() give you?

    .status_code is the HTTP status code, .text is the response body as a string, and .json() parses a JSON body into a Python object.

  26. Compare Django and Flask as Python web frameworks.

    Django is a full-stack, 'batteries-included' framework with a built-in ORM, admin, and auth; Flask is a lightweight micro-framework that is minimal and extended via add-ons. (FastAPI is a modern async framework with automatic validation.)

  27. What does REST stand for, and which HTTP methods map to the typical CRUD operations?

    Representational State Transfer; GET = read, POST = create, PUT/PATCH = update, and DELETE = delete.

  28. In REST APIs, what do HTTP status codes 200, 201, 404, and 500 indicate?

    200 OK (success), 201 Created (resource created), 404 Not Found, and 500 Internal Server Error.

  29. What is NumPy's core data structure, and what advantages does it offer over a Python list for numerical work?

    The ndarray (N-dimensional array); it stores homogeneous data in contiguous memory, enabling fast vectorized operations and using less memory than lists.

  30. In NumPy, what do the array attributes .shape, .dtype, and .ndim tell you?

    .shape gives the size along each dimension (as a tuple), .dtype gives the element data type, and .ndim gives the number of dimensions.

  31. What is NumPy broadcasting?

    A set of rules that lets NumPy perform element-wise operations on arrays of different shapes by virtually stretching the smaller array's dimensions to match, without copying data.

  32. In Pandas, what is the difference between a Series and a DataFrame?

    A Series is a one-dimensional labeled array; a DataFrame is a two-dimensional labeled table with rows and columns (a collection of Series sharing an index).

  33. In Pandas, what is the difference between .loc and .iloc for selecting data?

    .loc selects by label (row/column names), while .iloc selects by integer position.

  34. Which Pandas function reads a CSV file into a DataFrame, and which method writes a DataFrame back to CSV?

    pd.read_csv() reads a CSV into a DataFrame, and DataFrame.to_csv() writes it back out.

  35. In Pandas, what does the groupby() operation do, following the split-apply-combine pattern?

    It splits the data into groups based on key values, applies an aggregation or function to each group, and combines the results into a new object.

Python Programming Advanced Topics and Applied Libraries FAQ

What is in the Python Programming Advanced Topics and Applied Libraries syllabus?

Python Programming Advanced Topics and Applied Libraries is split into 6 chapters: Working with Data Formats, Concurrency and Parallelism, Testing and Debugging, Network and Web Programming, Data Science and Numerical Libraries and Type Hints and Modern Python. Together they contain 24 topics.

How many chapters are in Python Programming Advanced Topics and Applied Libraries?

6 chapters, containing 24 topics. The largest chapter is Working with Data Formats, with 4 topics.

Are there flashcards for Python Programming Advanced Topics and Applied Libraries?

Yes โ€” a 55-card Advanced Topics and Applied Libraries deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.