Halloween 2025 - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 65percent

Welcome To DumpsPedia

PCAP-31-03 Sample Questions Answers

Questions 4

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

Options:

A.

.3423e2

B.

3423e-2

C.

.3423e-2

D.

3423e2

Buy Now
Questions 5

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)

Options:

A.

put self.store(1])

B.

self put stire(1])

C.

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

D.

self .put (self.store[1])

Buy Now
Questions 6

What is the expected behavior of the following code?

Options:

A.

it outputs 1

B.

it outputs 2

C.

the code is erroneous and it will not execute

D.

it outputs 3

Buy Now
Questions 7

What is the expected output of the following code?

Options:

A.

4

B.

16

C.

an exception is raised

D.

1

Buy Now
Questions 8

What is the expected behavior of the following snippet?

It will:

Options:

A.

cause a runtime exception on line 02

B.

cause a runtime exception on line 01

C.

cause a runtime exception on line 03

D.

print3

Buy Now
Questions 9

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

Buy Now
Questions 10

What is the expected behavior of the following code?

Options:

A.

it outputs 6

B.

it outputs 1

C.

it outputs 3

D.

it raises an exception

Buy Now
Questions 11

How many elements will the list1 list contain after execution of the following snippet?

Options:

A.

two

B.

zero

C.

one

D.

three

Buy Now
Questions 12

What is the expected behavior of the following code?

Options:

A.

It outputs False

B.

It outputs nothing

C.

It outputs True

D.

It raises an exception

Buy Now
Questions 13

How many elements will the list2 list contain after execution of the following snippet?

list1 = [False for i in range (1, 10) ]

list2 = list1 [-1:1:-1]

Options:

A.

zero

B.

five

C.

seven

D.

three

Buy Now
Questions 14

What is the expected behavior of the following code?

Options:

A.

it outputs 2

B.

the code is erroneous and it will not execute

C.

it outputs 3

D.

it outputs :

Buy Now
Questions 15

What is the expected behavior of the following code?

Options:

A.

it outputs error

B.

it outputs list assignment index out of range

C.

the code is erroneous and it will not execute

D.

it outputs

Buy Now
Questions 16

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

Options:

A.

'var' in Object.__dict__

B.

'prop' in Class.__dict

C.

len(Object.__diet__) == 1

D.

'var1 in Class, dict

Buy Now
Questions 17

The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead of XXX?

Options:

A.

print (get(self))

B.

print (self.get())

C.

print (get())

D.

print (self.get (val))

Buy Now
Questions 18

What is the expected behavior of the following code?

Options:

A.

it outputs 3

B.

it outputs 1

C.

it outputs 6

D.

it raises an exception

Buy Now
Questions 19

Is it possible to safely check if a class object has a certain attribute0

Options:

A.

yes, by using the hasattr attribute

B.

yes. by using the hasattr () method

C.

yes, by using the hasattr () function

D.

no, it is not possible

Buy Now
Questions 20

Assuming that the following code has been executed successfully, select the expressions which evaluate to true.

(Select two answers.)

Options:

A.

a == b

B.

b {1} == 4

C.

a is not None

D.

a (2) == 4

Buy Now
Questions 21

What is the expected output of the following code?

Options:

A.

3

B.

5

C.

4

D.

an exception is raised

Buy Now
Questions 22

What is true about the __based__attribute in Python?

Options:

A.

It is accessible inside a class and an object.

B.

There is no such property.

C.

it is accessible inside an object

D.

It is accessible inside a class

Buy Now
Questions 23

What is the expected behavior of the following code?

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

Buy Now
Questions 24

What is the expected behavior of the following code?

Options:

A.

it outputs 1

B.

it outputs 0

C.

it raises an exception

D.

it outputs 2

Buy Now
Questions 25

What is the expected behavior of the following code?

It will

Options:

A.

print 2 1

B.

print 1 2

C.

cause a runtime exception

D.

print

Buy Now
Questions 26

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

Buy Now
Questions 27

A file name like this one below says mat: (select three answers)

services. cpython-36.pyc

Options:

A.

the interpreter used to generate the file is version 3.6

B.

it has been produced by CPython

C.

it is the 36th version of the file

D.

the file comes from the services . py source file

Buy Now
Questions 28

The first parameter of each method:

Options:

A.

holds a reference to the currently processed object

B.

is always set to None

C.

is set to a unique random value

D.

is set by the first argument's value

Buy Now
Questions 29

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

def idler ( ):

XXX

Options:

A.

pass

B.

return

C.

exit

D.

None

Buy Now
Questions 30

What is the expected behavior of the following code?

Options:

A.

the code is erroneus and it will not execute

B.

it outputs [2, 4]

C.

it outputs [4, 2]

D.

it outputs [0, 1, 2, 3, 4]

Buy Now
Questions 31

What is the expected output of the following code if there is no file named non existing_file inside the working directory?

Options:

A.

2 2

B.

1 3

C.

1 2 3

D.

2 2 3

Buy Now
Questions 32

Which of the following expressions evaluate to True?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 33

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

Options:

A.

'in not' in 'not'

B.

'in' in 'Thames'

C.

't' . upper ( ) in 'Thames'

D.

'in' in 'in'

Buy Now
Questions 34

A Python module named pymod.py contains a variable named pyvar.

Which of the following snippets will let you access the variable? (Select two answers)

Options:

A.

import pyvar from pymod pyvar = 1

B.

from pymod import pyvar = 1

C.

from pymod import pyvar pyvar ()

D.

import pymod pymod.pyvar = 1

Buy Now
Questions 35

What is the expected behavior of the following code?

Options:

A.

it raises an exception

B.

it outputs True

C.

it outputs False

D.

it outputs nothing

Buy Now
Questions 36

The following expression

1+-2

is:

Options:

A.

equal to 1

B.

invalid

C.

equal to 2

D.

equal to -1

Buy Now
Questions 37

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

Options:

A.

the__name__variable content determines the way in which the module was run

B.

a package can be stored as a tree of sub-directories/sub-folders

C.

__pycache__is the name of a built-in variable

D.

hashbang is the name of a built-in Python function

Buy Now
Questions 38

What is the expected behavior of the following code?

Options:

A.

it outputs 2

B.

the code is erroneous and it will not execute

C.

it outputs 1

D.

it outputs 3

Buy Now
Questions 39

Python strings can be “glued” together using the operator:

Options:

A.

.

B.

&

C.

_

D.

+

Buy Now
Questions 40

What is the expected behavior of the following code?

Options:

A.

it outputs False

B.

it outputs True

C.

it raises an exception

D.

it outputs nothing

Buy Now
Questions 41

If you want to transform a string into a list of words, what invocation would you use? (Select two answers)

Expected output:

Options:

A.

s.split ()

B.

split (s, "˜ "˜)

C.

s.split ("˜ "˜)

D.

split (s)

Buy Now
Questions 42

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

Options:

A.

len('\'•) == 1

B.

len("""

""") == o

C.

chr(ordCA') + 1) == 'B'

D.

ord("Z") - ord("z") -- ord("0")

Buy Now
Questions 43

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)

Buy Now
Questions 44

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

Options:

A.

obj_b.prop_a == 3

B.

hasattr(obj_b, 'prop_aa')

C.

isinstance(obj_c,A)

D.

B. VarA == 3

Buy Now
Questions 45

What is the expected behavior of the following code?

Options:

A.

it outputs 0

B.

it outputs 1

C.

it raises an exception

D.

it outputs 2

Buy Now
Questions 46

What is the expected output of the following snippet?

Options:

A.

True lower

B.

True upper

C.

False upper

D.

False lower

Buy Now
Exam Code: PCAP-31-03
Exam Name: Certified Associate in Python Programming
Last Update: Oct 22, 2025
Questions: 154
$57.75  $164.99
$43.75  $124.99
$36.75  $104.99
buy now PCAP-31-03