Big Halloween Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: simple70

Pass the Python Institute PCAP PCAP-31-03 Questions and answers with CertsForce

Viewing page 1 out of 5 pages
Viewing questions 1-10 out of questions
Questions # 1:

You are going to read just one character from a stream called s. Which statement would you use?

Options:

A.

ch = read(s, 1)


B.

ch = s. input(1)


C.

ch = input(s, 1)


D.

ch = s. read(l)


Expert Solution
Questions # 2:

The following expression

1+-2

is:

Options:

A.

equal to 1


B.

invalid


C.

equal to 2


D.

equal to -1


Expert Solution
Questions # 3:

Assuming that the code below has been placed inside a file named code.py and executed successfully which of the following expressions evaluate to True? (Select two answers)

Question # 3

Options:

A.

str (Object) = 'Object1


B.

Class A.__module__ == ' main__'


C.

len (ClassB.__bases__) == 2


D.

__name__== '__main__'


Expert Solution
Questions # 4:

Which of the following lines of code will work flawlessly when put independently inside the inc ( ) method in order to make the snippet’s output equal to 3? (Select two answers)

Question # 4

Question # 4

Options:

A.

put (self.prop + vaI)


B.

self.put (self.get ( ) + vaI)


C.

self.put (get ( ) + vaI)


D.

self.put (self.prop + vaI)


Expert Solution
Questions # 5:

Which of the following invocations are valid? (Select two answers)

Options:

A.

rfind("python","r")


B.

sorted("python")


C.

"python".sort ()


D.

"python".index("th")


Expert Solution
Questions # 6:

Which of the following snippets will execute without raising any unhandled exceptions? (Select answers)

A)

Question # 6

B)

Question # 6

C)

Question # 6

D)

Question # 6

Options:

A.

Option A


B.

Option B


C.

Option C


D.

Option D


Expert Solution
Questions # 7:

What is the expected behavior of the following code?

Question # 7

Options:

A.

it outputs -2


B.

it outputs 2. 0


C.

it outputs 0. 0


D.

the code is erroneous and it will not execute


Expert Solution
Questions # 8:

The following class hierarchy is given. What is the expected out of the code?

Question # 8

Options:

A.

BB


B.

CC


C.

AA


D.

BC


Expert Solution
Questions # 9:

Which of the following statements are true? (Select two answers)

Options:

A.

open () requires a second argument


B.

open () is a function which returns an object that represents a physical file


C.

instd, outstd, errstd are the names of pre-opened streams


D.

if invoking open () fails, an exception is raised


Expert Solution
Questions # 10:

Which of the following invocations are valid? (Select two answers)

Options:

A.

sorted ("python'')


B.

"python" .sort ( )


C.

sort" ("python")


D.

"python' ,find (" ")


Expert Solution
Viewing page 1 out of 5 pages
Viewing questions 1-10 out of questions