PCPP 32 10x PCPP Certified Professional Python Programmer 1 Exam Questions & Answers

Practice 42 free PCPP 32 10x PCPP Certified Professional Python Programmer 1 exam questions with answers and community-discussed explanations. Each question has its own page where you can reveal the correct answer and debate it in the comments.

All 42 questions

  1. Q1 Which of the following answers will create an empty class? (Select three)
  2. Q2 You are creating a simple calculator application using Tkinter in Python. The calculator has buttons for digits (0-9), basic arithmetic operations (+,…
  3. Q3 In Python's Tkinter module, which widget is used to create a drop-down menu with a list of options from which the user…
  4. Q4 You are reviewing a script that performs data analysis, and you notice that the code includes a complex conditional statement that spans…
  5. Q5 Consider the following code:response = requests.get('https://api.github.com')The response of a request often has some valuable information, known as a payload, in the request…
  6. Q6 Consider the following Python code snippet:class Meta(type): def __new__(cls, name, bases, attrs): new_class = super().__new__(cls, name, bases, attrs) new_class.instances = 0 original_init…
  7. Q7 You are developing a custom class MyInt that inherits from the built-in int class in Python. You want to add a new…
  8. Q8 Consider the following code snippet using Tkinter:from tkinter import Tk, Button, StringVar root = Tk()root.geometry('200x200') str_var = StringVar()str_var.set("Hello, Tkinter!") def update_text(): str_var.set("Button clicked!") button = Button(root,…
  9. Q9 Suppose you have the following function:def my_function():    """One-line description."""    passHow can you access the docstring using my_function object?
  10. Q10 You are developing a Python application that involves tracking instances of a Vehicle class. To ensure that every time a new vehicle…
  11. Q11 Assume that the following piece of code has been successfully executed:class Vehicle:    fleet = 0     def __init__(self, category=None):        self.category = category if category else 'vehicle'        Vehicle.fleet += 1     def __str__(self):        return self.category  class LandVehicle(Vehicle):    def __str__(self):        return super().__str__() + ': land'  class AirVehicle(Vehicle):    def __str__(self):        return super().__str__() + ': air'What is the expected output of the following piece of code?veh1 =…
  12. Q12 Python allows you to apply multiple decorators to a callable object (function, method or class). When your function is decorated with multiple…
  13. Q13 Consider the following XML document:<?xml version="1.0" encoding="UTF-8"?><bookstore> <book category="Fiction"> <title lang="en">The Great Gatsby</title> <author>F. Scott Fitzgerald</author> <year>1925</year> <price>10.99</price> </book> <book category="Non-Fiction"> <title…
  14. Q14 In Python, when a method is called on an instance of a class, what is the first argument that the method receives…
  15. Q15 You are tasked with designing a system to manage a library's book inventory using Python. Each book in the inventory is represented…
  16. Q16 You are developing a Python application that involves handling different types of vehicles. You have the following class hierarchy:class Vehicle: def __init__(self,…
  17. Q17 You are developing a Python class called Employee to manage employee data in a large organization. Each Employee object should be able…
  18. Q18 What is the result of the following code?from abc import ABC, abstractmethod class Figure(ABC): @abstractmethod def area(self): pass @abstractmethod def perimeter(self): pass…
  19. Q19 The Zen of Python says "Beautiful is better than ugly." With that in mind, which code best fits that sentence?
  20. Q20 Assuming that there is a class named Vehicle, write the very first line of the Python class declaration, expressing the fact that…
  21. Q21 An INI file is a configuration file for computer software that consists of a text-based content with a structure and syntax comprising…
  22. Q22 You are designing a set of classes to model a game where different characters can possess multiple abilities like swimming, flying, and…
  23. Q23 What is the result of the following code?import json  class Vector: def __init__(self, *components): self.components = components  def __repr__(self): return f'Vector{self.components}'  def __str__(self):…
  24. Q24 In Tkinter, which of the following statements is true about the StringVar class?
  25. Q25 Suppose you have the following request: import requests reply = requests.get('http://python.org:80')How can you access the headers and content-type information?
  26. Q26 Consider the following Python class:class MyClass: base = 10  @classmethod def modify_base(cls, new_base): cls.base = new_baseIf you instantiate two objects of this…
  27. Q27 Consider the following Python code:class Meta(type): def __new__(mcs, name, bases, attrs): attrs['custom_attr'] = 42 return super().__new__(mcs, name, bases, attrs)  class MyClass(metaclass=Meta): passWhich of…
  28. Q28 Python knows what to do when the interpreter spots the + operator between two objects - it looks for the magic method…
  29. Q29 The Zen of Python is an Easter Egg in Python that reveals a set of guiding principles for writing Python code. If…
  30. Q30 You are working on a Python program that interacts with a web server to fetch data. During testing, you receive the following…
  31. Q31 You are developing a Python application that interacts with a RESTful API. As part of the application's functionality, you need to analyze…
  32. Q32 Which function should you use to return the identity of an object in Python?
  33. Q33 You are working on a Python project that involves a series of mathematical operations. You have a function called calculate_sum that takes…
  34. Q34 You are developing a GUI application using Tkinter in Python. The application includes a Label at the top, a Text widget for…
  35. Q35 The iterator protocol is a way in which an object should behave to conform to the rules imposed by the context of…
  36. Q36 You are experimenting with Python's type metaclass to understand its role in class creation. You want to define a custom metaclass CustomMeta…
  37. Q37 Consider the following code snippet using Tkinter:from tkinter import Tk, Entry, StringVar def display_text(): print(entry_text.get()) root = Tk() entry_text = StringVar()entry_field = Entry(root, textvariable=entry_text)entry_field.pack() entry_text.set("Default text") root.mainloop()Which…
  38. Q38 Suppose you have the following class:class ProductionLine: def __init__(self, capacity): self.capacity = capacity  def __repr__(self): return f'ProductionLine(capacity={self.capacity})'  def __add__(self, other): return ProductionLine(self.capacity…
  39. Q39 Which of the following logging levels has the highest level of severity for log messages in logging package?
  40. Q40 Consider the following class hierarchy in Python:class Animal: def __init__(self, name): self.name = name def eat(self): print(f"{self.name} is eating.") class Mammal(Animal): def __init__(self,…
  41. Q41 Consider the following JSON data structure:{ "name": "John Doe", "age": 25, "city": "New York", "grades": [90, 85, 95, 92], "address": { "street":…
  42. Q42 Which of the following logs represents the default formatting of the root logger (logging module)?

More Python Institute certifications

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need