Certified Professional in Python Programming 1

Here you have the best Python Institute PCPP-32-101 practice exam questions

  • You have 31 total questions to study from
  • Each page has 5 questions, making a total of 7 pages
  • You can navigate through the pages using the buttons at the bottom
  • This questions were last updated on May 14, 2025
  • This site is not affiliated with or endorsed by Python Institute.
Question 1 of 31

Select the true statement about composition.

    Correct Answer: B

    Composition allows a class to be projected as a container of different classes. This is because composition involves building complex types by combining objects of other types, establishing a 'has-a' relationship. It promotes flexibility and modular code design since the container class can access the public interface of the contained classes, but not their internal details.

Question 2 of 31

Analyze the following snippet and select the statement that best describes it.

    Correct Answer: B

    The code is erroneous because the OwnMath class does not inherit from any Exception type class. In Python, exceptions must be derived from BaseException or its subclasses. Attempting to use a class that does not inherit from an exception base class as an exception will result in a TypeError. Therefore, the provided class definition for OwnMath is incorrect for exception handling purposes.

Question 3 of 31

Analyze the following snippet and select the statement that best describes it.

    Correct Answer: C

    The given code snippet defines a class named Sword. Within this class, 'var1' is set as a class variable with the value 'weapon'. The initializer method '__init__' defines 'self.name' as an instance variable and assigns it the value 'Excalibur'. So, 'Excalibur' is the value assigned to an instance variable when an object of the class Sword is created.

Question 4 of 31

The following snippet represents one of the OOP pillars. Which one is that?

    Correct Answer: D

    The snippet shows different classes where some have a method named 'run'. Despite the presence of the 'fly' method in class B, the attempt to execute 'run' on all instances showcases the concept of polymorphism. Polymorphism allows objects of different classes to be treated as objects of a common superclass. It facilitates the execution of the same method (or interface) in different ways for various object instances. In this example, the intention is to invoke the 'run' method polymorphically, although it would encounter an error due to the 'fly' method in class B.

Question 5 of 31

Analyze the following function and choose the statement that best describes it.

    Correct Answer: D

    The function presented is erroneous. The code references a variable 'our_function' which is not defined anywhere within the scope of the function. Additionally, there is a missing colon in line 3. These issues would result in a NameError when the code is executed, thus making the function incorrect as written. To correct this, ensuring that the referenced function names are consistent and properly defined is necessary.