Python Institute - Big Savings Alert – Don’t Miss This Deal - Ends In 1d 00h 00m 00s Coupon code: 26Y30OFF
  1. Home
  2. Python Institute
  3. PCPP-32-101 Exam
  4. Free PCPP-32-101 Questions

Free Practice Questions for Python Institute PCPP-32-101 Exam

Pass4Future also provide interactive practice exam software for preparing Python Institute PCPP1 - Certified Professional in Python Programming 1 (PCPP-32-101) Exam effectively. You are welcome to explore sample free Python Institute PCPP-32-101 Exam questions below and also try Python Institute PCPP-32-101 Exam practice test software.

Page:    1 / 14   
Total 45 questions

Question 1

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



Answer : B

The provided code snippet defines a functionf1that accepts variable-length arguments using the*argsand**kwargssyntax. The*argsparameter allows for an arbitrary number of unnamed arguments to be passed to the function as a tuple, while the**kwargsparameter allows for an arbitrary number of named arguments to be passed to the function as a dictionary.

Therefore, the correct statement that best describes the code is:

1. The*argsparameter holds a list of unnamed parameters, while the**kwargsparameter holds a dictionary of named parameters.


Official Python documentation on Function definitions:https://docs.python.org/3/tutorial/controlflow.html#defining-functions

Thearg parameter holds a list of unnamed parameters. In the given code snippet, thef1function takes two arguments:*argand**kwarg. The*argsyntax in the function signature is used to pass a variable number of non-keyword (positional) arguments to the function. Inside the function,argis a tuple containing the positional arguments passed to the function. The**kwargsyntax in the function signature is used to pass a variable number of keyword arguments to the function. Inside the function,kwargis a dictionary containing the keyword arguments passed to the function.

Question 2

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 3

Select the true statement related to PEP 257.



Question 4

Look at the following code snippets and decide which ones follow PEP 8 recommendations for whitespaces in expressions and statements (Select two answers.)

A)

No whitespace immediately before the opening parenthesis that starts the list of arguments of a function call:

B)

A whitespace immediately before a comma, semicolon, and colon:

C)

No whitespace between a trailing comma and a following closing parenthesis:

D)

A whitespace immediately after the opening parenthesis that starts indexing or slicing:



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


Page:    1 / 14   
Total 45 questions