ExamDumpster

Free PCPP-32-101 sample questions

Real questions from the PCPP1 – Certified Professional Python Programmer Level 1 practice bank, with the correct answer and an explanation for each one. No junk, no filler.

Try them in the simulator Same questions, with study, timed and flashcard modes.

Showing 10 of 20 free sample questions.

Question 1Choose one

A financial services company is developing a framework where different asset classes must be represented. A base `Asset` class is defined. `Stock` and `Bond` classes inherit from `Asset`. A `Portfolio` class is then created, which holds a collection of `Asset` objects. Which two primary OOP principles are demonstrated by the `Portfolio` class's relationship with the `Asset`, `Stock`, and `Bond` classes?

Question 2Choose one

A developer needs to create a decorator that accepts an argument, for example, `@retry(attempts=3)`. Which code structure correctly implements a decorator that takes its own arguments?

Question 3Choose one

You are reviewing Python code and find the following line inside an `except` block: `raise ConnectionError("Failed to connect to database") from exc` What is the primary purpose of the `from exc` syntax in this context?

Question 4Choose one

A developer is writing a REST client using the `requests` library to fetch user data from an API endpoint. The API requires a custom header `X-API-Key` for authentication. Which code snippet correctly sends a GET request to `https://api.example.com/users/123` with the required custom header?

Question 5Choose one

According to PEP 8, what is the recommended way to check if a list named `my_list` is empty?

Question 6Choose one

A developer is using the `csv` module to write data to a file. They want to ensure that each row is written from a dictionary, where the dictionary keys correspond to the header row. Which combination of `csv` module components should be used to open the file and write the rows?

Question 7Choose one

When designing a GUI with `tkinter`, what is the fundamental difference between the `grid` and `place` geometry managers?

Question 8Choose one

A developer needs to create a custom class that behaves like a dictionary but logs a message every time a key is accessed. Which magic method must be implemented to intercept key retrieval?

Question 9Choose one

What is the primary motivation for using the `shelve` module over the `pickle` module for object persistence?

Question 10Choose one

True or False: In Python's `socket` module, TCP sockets are created using `socket.SOCK_DGRAM` and UDP sockets are created using `socket.SOCK_STREAM`.

10 more free samples are waiting

Create a free account to unlock the whole PCPP-32-101 sample bank, or get full access to all 218 practice questions in the simulator.

Create account