Sample questions
Python Institute Certified Professional in Python Programming 1 (PCPP1, PCPP-32-101) (PCPP1) practice questions
In the context of the Factory pattern, what does a concrete factory implement?
You are writing a Python script that needs to send a GET request to a REST API and parse the JSON response. The API requires an API key passed as a query parameter. Which code snip…
Which standard Python library module is used for lower-level networking and creating server/client sockets?
In the csv module, how do you specify that the CSV file uses a semicolon (;) as a delimiter?
You are creating a Tkinter GUI with a Canvas widget to draw a simple chart. You need to draw a filled blue rectangle from (50, 50) to (150, 100). Which Canvas method call achieves…
What is the primary difference between @classmethod and @staticmethod?
A developer is writing a Python module and wants to follow best practices for documenting functions. Which TWO of the following are recommended by PEP 257 for docstrings? (Choose t…
What is the primary benefit of using 'logging' over 'print' statements for application diagnostics?
You want to bind a function 'on_click' to a left mouse button click on a Button widget. Which event sequence string is correct?
Which method in the xml.dom.minidom module is used to retrieve the value of a specific attribute of an element?
You are developing a multithreaded HTTP scraper. When using the 'requests' library inside 'threading.Thread' objects, what is the recommended practice for handling session persiste…
You are refactoring code that performs sensitive operations. Which of the following is the most secure practice for handling secret keys?
According to PEP 8, what is the maximum recommended length for a line of code?
You are writing a Python utility that copies a directory tree to a network share using shutil. You must preserve file metadata and fail loudly if the destination already contains a…
You are consuming a REST API that returns data in JSON format. After calling response.json(), you notice the data contains nested dictionaries. What is the most Pythonic way to han…
You are designing a REST client that must call an endpoint protected by OAuth 2.0 using the client credentials grant. The authorization server expects the client identifier and cli…
In a Tkinter grid layout, you want a button to span across two columns. Which parameter should you use?
Which THREE practices improve documentation maintenance?
What is the effect of setting __slots__ in a parent class on a child class that does not define its own __slots__?
What is the consequence of not calling super().__init__() in a class with multiple inheritance?
What is the purpose of the __repr__ method?
You are implementing the Observer pattern. Why should you avoid using a strong reference to the observers in the subject's list?
In Python socket programming, what does the 'SO_REUSEADDR' socket option achieve?
Which comment style is preferred for block comments in Python?