Pre-Summer Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: validbest

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

Exam PCAP-31-03 All Questions
Exam PCAP-31-03 Premium Access

View all detail and faqs for the PCAP-31-03 exam

Viewing page 2 out of 5 pages
Viewing questions 11-20 out of questions
Questions # 11:

Which of the equations are True? (Select two answers)

Options:

A.

chr (ord (x)) = = x

B.

ord (ord (x)) = = x

C.

chr (chr (x)) = = x

D.

ord (chr (x)) = = x

Expert Solution
Questions # 12:

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

An operator able to perform bitwise shifts is coded as (select two answers)

Options:

A.

- -

B.

++

C.

<<

D.

>>

Expert Solution
Questions # 14:

Select the valid fun () invocations:

(select two answers)

def fun (a, b=0):

return a*b

Options:

A.

fun(b=1)

B.

fun (a=0)

C.

fun(b=1, 0)

D.

fun (1)

Expert Solution
Questions # 15:

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

Options:

A.

a code point is a point inside the code when execution stops immediately

B.

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

C.

UTF-8 is one of the ways of representing UNICODE code points.

D.

ASCII is the name of a character coding standard

Expert Solution
Questions # 16:

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

Assuming that the following code has been executed successfully, select the expressions which evaluate to True (Select two answers)

Question # 17

Options:

A.

a is b

B.

b( ) > 2

C.

a() > 2

D.

a is not None

Expert Solution
Questions # 18:

What is the expected behavior of the following code?

Question # 18

Options:

A.

it outputs 3

B.

it outputs 1

C.

it outputs 6

D.

it raises an exception

Expert Solution
Questions # 19:

What would you use instead of XXX if you want to check whether a certain ‘ key' exists in a dictionary called diet? (Select two answers)

II

if XXX:

print("Key exists")

Options:

A.

'key' in diet

B.

diet['key'] != None

C.

diet.exists('key')

D.

'key' in diet.keys()

Expert Solution
Questions # 20:

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
Viewing page 2 out of 5 pages
Viewing questions 11-20 out of questions