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

Viewing page 4 out of 5 pages
Viewing questions 31-40 out of questions
Questions # 31:

Which of the following lines of code will work flawlessly when put independently inside the add_new () method in order to make the snippet's output equal to [0, 1, 1] ? (Select two answers)

Question # 31

Options:

A.

put self.store(1])


B.

self put stire(1])


C.

self .put self.get () [-1])


D.

self .put (self.store[1])


Expert Solution
Questions # 32:

What is the expected behavior of the following code?

Question # 32

Options:

A.

it outputs 'None'


B.

it outputs 3


C.

it raises an exception


D.

it outputs 0


Expert Solution
Questions # 33:

You are going to read 16 bytes from a binary file into a bytearray called data. Which lines would you use? (Select two answers)

Options:

A.

data = bytearray (16) bf.readinto (data)


B.

data = binfile.read (bytearray (16))


C.

bf. readinto (data = bytearray (16))


D.

data = bytearray (binfile.read (16))


Expert Solution
Questions # 34:

Python's built-in function named open () tries to open a file and returns:

Options:

A.

an integer value identifying an opened file


B.

an error code (0 means success)


C.

a stream object


D.

always None


Expert Solution
Questions # 35:

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

Options:

A.

an escape sequence can be recognized by the / sign put in front of it


B.

II in ASCII stands for Internal Information


C.

ASCII is a subset of UNICODE


D.

a code point is a number assigned to a given character


Expert Solution
Questions # 36:

What is the expected output of the following snippet?

Question # 36

Options:

A.

True False


B.

True True


C.

False False


D.

False True


Expert Solution
Questions # 37:

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 # 38:

What is the expected behavior of the following code?

Question # 38

Options:

A.

it outputs list assignment index out of range


B.

the code is erroneous and it will not execute


C.

it outputs


D.

it outputs error


Expert Solution
Questions # 39:

Which of the following expressions evaluate to True? (Select two answers)

Options:

A.

121 +1 == int ('1' + 2 * '2')


B.

float ('3.14') == str('3.'+'14')


C.

'xyz'.lower() 'XY'


D.

'8' + '8' !=2 * '8'


Expert Solution
Questions # 40:

What is the expected behavior of the following code?

x - 3 % 1

y -1 if x > else 0

print (y)

Options:

A.

it outputs -1


B.

the code is erroneous and it will not execute


C.

it outputs 1


D.

it outputs 0


Expert Solution
Viewing page 4 out of 5 pages
Viewing questions 31-40 out of questions