Python Institute PCPP-32-101 Exam
Certified Professional in Python Programming 1 (Page 2 )

Updated On: 26-Jan-2026

Select the true statement about composition

  1. Composition extends a class's capabilities by adding new components and modifying the existing ones.
  2. Composition allows a class to be projected as a container of different classes
  3. Composition is a concept that promotes code reusability while inheritance promotes encapsulation.
  4. Composition is based on the has a relation: so it cannot be used together with inheritance.

Answer(s): B

Explanation:

Composition is an object-oriented design concept that models a has-a relationship. In composition, a class known as composite contains an object of another class known as component. In other words, a composite class has a component of another class.
1. Composition allows a class to be projected as a container of different classes. Composition is a concept in Python that allows for building complex objects out of simpler objects, by aggregating one or more objects of another class as attributes. The objects that are aggregated are generally considered to be parts of the whole object, and the containing object is often viewed as a container for the smaller objects.
In composition, objects are combined in a way that allows for greater flexibility and modifiability than what inheritance can offer. With composition, it is possible to create new objects by combining existing objects, by using a container object to host other objects. By contrast, with inheritance, new objects extend the behavior of their parent classes, and are limited by that inheritance hierarchy.


Reference:

Official Python documentation on
Composition: https://docs.python.org/3/tutorial/classes.html#composition GeeksforGeeks article on Composition vs Inheritance: https://www.geeksforgeeks.org/composition- vs-inheritance-python/
Real Python article on Composition and Inheritance: https://realpython.com/inheritance- composition-python/



What is true about the unbind () method? (Select two answers.)

  1. It is invoked from within the events object
  2. It is invoked from within a widget's object
  3. It needs a widget's object as an argument
  4. It needs the event name as an argument

Answer(s): B,D

Explanation:

Option B is true because the unbind() method is invoked from within a widget's object. Option D is true because the unbind() method needs the event name as an argument.

The unbind() method in Tkinter is used to remove a binding between an event and a function. It can be invoked from within a widget's object when a binding is no longer needed. The method requires the event name as an argument to remove the binding for that specific event. For example:
button = tk.Button(root, text="Click me")
button.bind("<Button-1>", callback_function) # bind left mouse click event to callback_function button.unbind("<Button-1>") # remove the binding for the left mouse click event



If purple can be obtained from mixing red and blue, which color codes represent the two ingredients? Select two answers)

  1. #FFFFFF
  2. #0000FF
  3. #FF0000
  4. #000000

Answer(s): B,C



What is true about the invocation of the cget () method?

  1. It can be used to read widget attributes.
  2. It has the same effect as the config () method.
  3. It can be used to set new values to widget attributes.
  4. It can be replaced with a dictionary-like access manner.

Answer(s): A

Explanation:

The cget() method in Python is used to read the configuration options of a widget in Tkinter. It retrieves the value of a specified configuration option for a Tkinter widget. Hence, option A is the correct answer.



Which of the following will set the button text's font to 12 point italics Anal? (Select two answers)









Answer(s): B,C

Explanation:

Option B is correct because it sets the font option of the button to a tuple containing the font family (`Arial'), size (12), and style (`italic').
Option C is correct because it sets the font option of the button to a string containing the font family (`Arial'), size (12), and style (`italic') separated by spaces.



Viewing page 2 of 10
Viewing questions 6 - 10 out of 80 questions



Post your Comments and Discuss Python Institute PCPP-32-101 exam prep with other Community members:

Join the PCPP-32-101 Discussion