Labour Day Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: scxmas70

PCAP-31-03 Exam Dumps - Certified Associate in Python Programming

Question # 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)

A.

put (self.prop + vaI)

B.

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

C.

self.put (get ( ) + vaI)

D.

self.put (self.prop + vaI)

Full Access
Question # 5

What is the expected behavior of the following code?

It will:

A.

print 4321

B.

print

C.

cause a runtime exception

D.

print 1234

Full Access
Question # 6

What is the expected output of the following snippet?

A.

abc

B.

The code will cause a runtime exception

C.

ABC

D.

123

Full Access
Question # 7

What is the expected behavior of the following code?

It will:

A.

print 0

B.

cause a runtime exception

C.

prints 3

D.

print an empty line

Full Access
Question # 8

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

A.

BB

B.

CC

C.

AA

D.

BC

Full Access
Question # 9

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

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

Full Access
Question # 10

Which of the following literals reflect the value given as 34.23? (select two answers)

A.

.3423e2

B.

3423e-2

C.

.3423e-2

D.

3423e2

Full Access
Question # 11

What is true about Python class constructors? (Select two answers)

A.

the constructor's first parameter identifies an object currently being created

B.

the constructor cannot use the default values of the parameters

C.

the constructor can be invoked directly under strictly defined circumstances

D.

super-class constructor is invoked implicitly during constructor execution

Full Access
Question # 12

If you need a function that does nothing, what would you use instead of XXX? (Select two answers)

def idler ( ):

XXX

A.

pass

B.

return

C.

exit

D.

None

Full Access
Question # 13

Which of the following words can be used as a variable name? (Select two valid names)

A.

for

B.

True

C.

true

D.

For

Full Access
Question # 14

What is true about the following snippet? (Select two answers)

A.

the code will raise an unhandled exception

B.

the string I feel fine 'will be seen

C.

the string it's nice to see you will be seen

D.

the string what a pity will be seen

Full Access
Question # 15

A compiler is a program designed to (select two answers)

A.

rearrange the source code to make it clearer

B.

check the source code in order to see if its correct

C.

execute the source code

D.

translate the source code into machine code

Full Access
Question # 16

What is the expected output of the following code?

A.

2

B.

3

C.

4

D.

an exception is raised

Full Access
Question # 17

What is the expected output of the following code?

A.

21

B.

2

C.

3

D.

12

Full Access
Question # 18

What is the expected behavior of the following code?

A.

it outputs 2

B.

the code is erroneous and it will not execute

C.

it outputs 1

D.

it outputs 3

Full Access
Question # 19

What can you deduce from the following statement? (Select two answers)

str = open('file.txt', "rt")

A.

str is a string read in from the file named file.txt

B.

a newlina character translation will be performed during the reads

C.

if file. txt does not exist, it will be created

D.

the opened file cannot be written with the use of the str variable

Full Access
Question # 20

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

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))

Full Access
Question # 21

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)

A.

put self.store(1])

B.

self put stire(1])

C.

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

D.

self .put (self.store[1])

Full Access
Question # 22

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()

A.

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

B.

v1 == v2

C.

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

D.

v1 >= 1

Full Access