Summer Sale Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

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

Page: 1 / 7
Total 69 questions

PCPP1 – Certified Professional in Python Programming 1 Questions and Answers

Question 1

The following JSON string:

{ 1 }

Options:

A.

is erroneous

B.

is an object

C.

is an array

D.

is an integer

Question 2

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

Question # 2

Options:

A.

The code is an example of implicitly chained exceptions.

B.

The code is erroneous as the OwnMath class does not inherit from any Exception type class

C.

The code is fine and the script execution is not interrupted by any exception.

D.

The code is an example of explicitly chained exceptions.

Question 3

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

A)

Question # 3

B)

Question # 3

C)

Question # 3

D)

Question # 3

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 4

Select the true statement about PEP 8 recommendations related to line breaks and binary operators.

Options:

A.

It is recommended that you use line breaks before binary operators to improve code readability.

B.

It is permissible to use line breaks before or after a binary operator as long as the convention is consistent locally However, for new code it is recommended that break lines should be used only after binary operators.

C.

It is recommended that you use line breaks after binary operators to improve code readability.

D.

There is no specific PEP 8 recommendation related to using line breaks with binary operators.

Question 5

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

Question # 5

Options:

A.

Serialization

B.

Inheritance

C.

Encapsulation

D.

Polymorphism

Question 6

Select the correct statements about the csv module.

(Select two answers.)

Options:

A.

The DictReader method always gets the header from the first line in the file.

B.

A reader object maps each row to a list of strings.

C.

It is possible to create a DictWriter object without specifying a header.

D.

A DictReader object maps each row to a dict.

Question 7

What will happen if the mam window is too small to fit all its widgets?

Options:

A.

Some widgets may be invisible

B.

The window will be expanded.

C.

An exception will be raised.

D.

The widgets will be scaled down to fit the window's size.

Question 8

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:

Question # 8

B)

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

Question # 8

C)

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

Question # 8

D)

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

Question # 8

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 9

Select the true statements about the json.-dumps () function. (Select two answers.)

Options:

A.

It returns a JSON string.

B.

It returns a Python entity.

C.

It takes a JSON string as its argument

D.

It takes Python data as its argument.

Question 10

What is true about the unbind_all () method?

(Select two answers.)

Options:

A.

It can be invoked from any widget

B.

It can be invoked from the main window widget only

C.

It is parameterless

D.

It causes all the widgets to disappear

Question 11

What is true about the following snippet of code?

class Cat:

def __init__(self, weight, sex):

self.height = height

self.weight = weight

self.sex = sex

def say(self):

print('meows')

kitty = Cat(1, 'male')

kitty.say()

Options:

A.

The snippet will print: 1 male.

B.

The snippet will cause a NameError exception.

C.

The snippet will print: meows.

D.

The snippet will cause a ValueError exception.

Question 12

Look at the following examples of comments and docstrings in Python Select the ones that are useful and compliant with PEP 8 recommendations (Select the two best answers.)

A)

Question # 12

B)

Question # 12

C)

Question # 12

D)

Question # 12

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 13

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

Question # 13

Options:

A.

self. name is the name of a class variable.

B.

varl is the name of a global variable

C.

Excalibur is the value passed to an instance variable

D.

Weapon is the value passed to an instance variable

Question 14

Select the true statements about PEP 8 recommendations related to using blank lines. (Select two answers.)

Options:

A.

You should not put any blank lines between groups of imports.

B.

You should surround top-level functions and class definitions with one blank line.

C.

You should surround top-level functions and class definitions with two blank lines.

D.

You should surround method definitions inside classes by a single blank line.

Question 15

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

class Sword:

var1 = 'weapon'

def __init__(self):

self.name = 'Excalibur'

s1 = Sword()

Options:

A.

The snippet will cause an AttributeError exception.

B.

The snippet will cause a ValueError exception.

C.

The class variable value can be updated with the following code: cls.var1

D.

The class variable value can be updated with the following code: Sword.var1

Question 16

What is ElementTree?

Options:

A.

A Python built-in module that contains functions used for creating HTML files.

B.

A Python library that contains an API used for parsing and manipulating JSON files.

C.

A Python library that contains functions and tools used for manipulating text files in GUI Programming.

D.

A Python built-in module that contains functions used for parsing and creating XML data.

Question 17

What is a___traceback___?

(Select two answers )

Options:

A.

An attribute owned by every exception object

B.

A special method delivered by the traceback module to retrieve a full list of strings describing the traceback

C.

An attribute that is added to every object when the traceback module is imported

D.

An attribute that holds interesting information that is particularly useful when the programmer wants to store exception details in other objects

Question 18

Select the true statements related to PEP 8 programming recommendations for code writing. (Select two answers:)

Options:

A.

You should use the not ... is operator (e.g. if not spam is None:), rather than the is not operator (e.g. if spam is not None:), to increase readability.

B.

You should make object type comparisons using the ismstanceQ method (e.g. if isinstance (obj, int) :) instead of comparing types directly (eg if type(obj) is type(i)).

C.

You should write code in a way that favors the CPython implementation over PyPy, Cython. and Jython.

D.

You should not write string literals that rely on significant trailing whitespaces as they may be visually indistinguishable, and certain editors may trim them

Question 19

Select the true statements about the following invocation:

Question # 19

(Select two answers.)

Options:

A.

It addresses a service deployed at localhost (the host where the code is run).

B.

It addresses a service whose timeout is set to 3000 ms.

C.

It addresses a service located at the following address local.host.com.

D.

It addresses a service listening at port 3000.

Question 20

Which methods can be invoked in order to draw a triangle?

(Select two answers.)

Options:

A.

create_shape()

B.

create_line()

C.

create_triangle_shape()

D.

create_polygon()

Page: 1 / 7
Total 69 questions