Winter Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: s2p65

Easiest Solution 2 Pass Your Certification Exams

PCAP-31-03 Python Institute Certified Associate in Python Programming Free Practice Exam Questions (2025 Updated)

Prepare effectively for your Python Institute PCAP-31-03 Certified Associate in Python Programming certification with our extensive collection of free, high-quality practice questions. Each question is designed to mirror the actual exam format and objectives, complete with comprehensive answers and detailed explanations. Our materials are regularly updated for 2025, ensuring you have the most current resources to build confidence and succeed on your first attempt.

Page: 1 / 3
Total 154 questions

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

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

A.

.

B.

&

C.

_

D.

+

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

A.

'key' in diet

B.

diet['key'] != None

C.

diet.exists('key')

D.

'key' in diet.keys()

What is the expected output of the following code if existing_file is the name of a file located inside the working directory?

A.

1 2

B.

1 2 3

C.

1 3

D.

2 3

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, 21 ? (Select two answers)

A.

self.queue.append(get_Iast() + 1)

B.

queue.append(self.get last () + 1)

C.

self.queue.append(self.queue[+1]

D.

self.queue.append(self.get last() +1)

Is it possible to safely check if a class/object has a certain attribute?

A.

yes, by using the hasattr attribute

B.

yes, by using the hasattr ( ) method

C.

yes, by using the hassattr ( ) function

D.

no, it is not possible

Assuming that String is six or more letters long, the following slice

String[1:-2]

is shorter than the original string by:

A.

four chars

B.

three chars

C.

one char

D.

two chars

Which of the following expressions evaluate to True?

A)

B)

C)

D)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

What is the expected behavior of the following code?

A.

Its outputs 321

B.

It raises an exception.

C.

It outputs 6.

D.

It outputs 123.

The__bases__property contains:

A.

base class locations (addr)

B.

base class objects (class)

C.

base class names (str)

D.

base class ids (int)

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

A.

'var' in Object.__dict__

B.

'prop' in Class.__dict

C.

len(Object.__diet__) == 1

D.

'var1 in Class, dict

Which of the following lambda definitions are correct? (Select two answers)

A.

lanbda x, y; return x\\y - x%y

B.

lambda x, y: x//y - x%y

C.

lambda (x, y = x\\y x%y

D.

lambda x, y: (x, y)

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

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

A variable stored separately in every object is called:

A.

there are no such variables, all variables are shared among objects

B.

a class variable

C.

an object variable

D.

an instance variable

What is the expected behavior of the following code?

x - 3 % 1

y -1 if x > else 0

print (y)

A.

it outputs -1

B.

the code is erroneous and it will not execute

C.

it outputs 1

D.

it outputs 0

What is the expected output of the following code?

A.

a

B.

an exception is raised

C.

b

D.

c

A Python module named pymod, py contains a function named pyfun ( ).

Which of the following snippets will let you invoke the function? (Select two answers)

A.

From pymod import ‘

Pymod.pyfun ( )

B.

Import pymod

Pymod. Pyfun ( )

C.

Import pyfun from pymod

Pyfun ( )

D.

From pymod import pyfun

Pyfun ( )

How many lines does the following snippet output?

A.

three

B.

one

C.

two

D.

four

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

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.

What is the expected output of the following snippet?

A.

True lower

B.

True upper

C.

False upper

D.

False lower

Page: 1 / 3
Total 154 questions
Copyright © 2014-2025 Solution2Pass. All Rights Reserved