Python Institute PCPP-32-101 PCPP1 - Certified Professional in Python Programming 1 Exam Practice Test

Page: 1 / 14
Total 45 questions
Question 1

What is ElementTree?



Answer : D

ElementTree is a Python built-in module that provides a simple and efficient API for parsing and creating XML data. It allows you to access and manipulate XML data in a very straightforward way, making it easy to write XML processing applications.


This statement is true because ElementTree is a module in the standard library of Python that provides an API for working with XML data. The module supports parsing XML from strings or files, creating XML trees from scratch or modifying existing ones, searching and iterating over XML elements, and writing XML data to strings or files.

Question 2

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

A)

B)

C)

D)



Answer : B, C

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.


Question 3

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



Answer : A

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.


Question 4

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



Answer : B, C


Question 5

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



Answer : B, D

Option B is true because theunbind()method is invoked from within a widget's object1.

Option D is true because theunbind()method needs the event name as an argument1.

Theunbind()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


Question 6

What is true about type in the object-oriented programming sense?



Answer : C

In Python,typeis the built-in metaclass that serves as the base class for all new-style classes. All new-style classes in Python, including built-in types likeintandstr, are instances of thetypemetaclass and inherit from it.


Question 7

What is a static method?



Answer : C

A static method is a method that belongs to a class rather than an instance of the class. It is defined using the@staticmethoddecorator and does not take aselforclsparameter. Static methods are often used to define utility functions that do not depend on the state of an instance or the class itself.


Page:    1 / 14   
Total 45 questions