Big Halloween Sale 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sale65best

Free Python Institute PCAP-31-03 Practice Exam with Questions & Answers | Set: 4

Questions 31

What is the expected behavior of the following code?

PCAP-31-03 Question 31

It will:

Options:
A.

print 0

B.

cause a runtime exception

C.

prints 3

D.

print an empty line

Questions 32

What is the expected behavior of the following code?

PCAP-31-03 Question 32

Options:
A.

the code is erroneous and it will not execute

B.

it outputs 'tuple' object does not support item assignment

C.

0it outputs list assignment index out of range

D.

it outputs None

Questions 33

Assuming that the following snippet has been successfully executed, which of the equations are True? (Select two answers)

PCAP-31-03 Question 33

Options:
A.

len(a) == len (b)

B.

b[0] fe- 1 == a[0]

C.

a [0] == b [0]

D.

a[0] + 1 == b[0]

Questions 34

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

Questions 35

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

Options:
A.

str(1-1) in '012345£739'[:2]

B.

'phd' in 'alpha'

C.

'deb' not in 'abcde' [::-1]

D.

'True' not in 'False'

Questions 36

What is the expected behavior of the following code?

PCAP-31-03 Question 36

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]

Questions 37

Which line can be used instead of the comment to cause the snippet to produce the following expected output? (Select two answers)

Expected output:

1 2 3

Code:

PCAP-31-03 Question 37

Options:
A.

c, b, a = b, a, c

B.

c, b, a = a, c, b

C.

a, b, c = c, a, b

D.

a, b, c = a, b, c

Questions 38

What is true about Python class constructors? (Choose two.)

Options:
A.

there can be more than one constructor in a Python class

B.

the constructor must return a value other than None

C.

the constructor is a method named __init__

D.

the constructor must have at least one parameter

Questions 39

You need data which can act as a simple telephone directory. You can obtain it with the following clauses (choose two relevant variants; assume that no other items have been created before)

Options:
A.

dir={'Mom':5551234567, 'Dad':5557654321>

B.

dir={'Mom':'5551234567', * Dad':'5557654321'}

C.

dir={Mom:5551234567, Dad:5557654321}

D.

dir={Mom:'5551234567', Dad:'5557654321'}

Questions 40

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

Options:
A.

the constructor must have at least one parameter

B.

the constructor must return a value other than None

C.

the constructor is a method named_init_

D.

there can the more than one constructor in a Python class.

Exam Code: PCAP-31-03
Certification Provider: Python Institute
Exam Name: Certified Associate in Python Programming
Last Update: Oct 30, 2025
Questions: 154

Python Institute Free Exams

Python Institute Free Exams
Examstrack offers free Python Institute exam materials and practice tests to aid your Python Institute certification journey.