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

What is the expected behavior of the following code?

x = 8 ** (1/3)

y = 2. if x < 2.3 else 3.

print(y)

Options:

A.

it outputs 2.0


B.

it outputs 2. 5


C.

the code is erroneus and it will not execute


D.

it outputs 3.0


Expert Solution
Questions # 12:

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

Options:

A.

closing an open file is performed by the closefile ( ) function


B.

the second open ( ) argument describes the open mode and defaults to ‘w’


C.

if open ( ) ‘s second argument is ‘r’ the file must exist or open will fail


D.

if open ( )’s second argument is ‘w’ and the invocation succeeds, the previous file’s content is lost


Expert Solution
Questions # 13:

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

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

A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:

Options:

A.

lambda (x, y) = x ** y


B.

lambda (x, y): x ** y


C.

def lambda (x, y): return x ** y


D.

lambda x, y: x ** y


Expert Solution
Questions # 16:

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

Options:

A.

- -


B.

++


C.

<<


D.

>>


Expert Solution
Questions # 17:

Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Select two answers)

import random

v1 = random. random()

v2 = random. random()

Options:

A.

len(random.sample([1,2,3],2)) > 2


B.

v1 == v2


C.

random.choice([1,2,3]) >=1


D.

v1 >= 1


Expert Solution
Questions # 18:

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 # 18

Options:

A.

str(Object) == 'Object'


B.

_name == _main_'


C.

ClassA. _module_ == 'ClassA'


D.

len(ClassB.__bases__) == 1


Expert Solution
Questions # 19:

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

Question # 19

Options:

A.

a is not None


B.

a ! =b


C.

b () ==4


D.

a () == 4


Expert Solution
Questions # 20:

What is true about Python packages? (Select two answers)

Options:

A.

the sys.path variable is a list of strings


B.

_pycache_is a folder that stores semi-completed Python modules


C.

a package contents can be stored and distributed as an mp3 file


D.

a code designed to initialize a package's state should be placed inside a file named init.py


Expert Solution
Viewing page 2 out of 5 pages
Viewing questions 11-20 out of questions