New Year Special Sale - 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: spcl70

Practice Free PCAP-31-03 Certified Associate in Python Programming Exam Questions Answers With Explanation

We at Crack4sure are committed to giving students who are preparing for the Python Institute PCAP-31-03 Exam the most current and reliable questions . To help people study, we've made some of our Certified Associate in Python Programming exam materials available for free to everyone. You can take the Free PCAP-31-03 Practice Test as many times as you want. The answers to the practice questions are given, and each answer is explained.

Question # 6

With regards to the directory structure below, select the proper forms of the directives in order to import module_c. (Select two answers)

PCAP-31-03 question answer

A.

from pypack.upper.lower import module_c

B.

import pypack.upper.lower.module_c

C.

import upper.module_c

D.

import upper.lower.module_c

Question # 7

What is the expected output of the following code?

PCAP-31-03 question answer

A.

True

B.

0

C.

False

D.

None

Question # 8

What is the expected output of the following code?

PCAP-31-03 question answer

A.

21

B.

2

C.

3

D.

12

Question # 9

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

Question # 10

Can a module run like regular code?

A.

yes, and it can differentiate its behavior between the regular launch and import

B.

it depends on the Python version

C.

yes, but it cannot differentiate its behavior between the regular launch and import

D.

no. it is not possible; a module can be imported, not run

Question # 11

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

Question # 12

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

A.

for

B.

True

C.

true

D.

For

Question # 13

What is the expected output of the following code if the file named existing_text_file is a non-zero length text file located inside the working directory?

PCAP-31-03 question answer

A.

the length of the first line from the file

B.

-1

C.

the number of lines contained inside the file

D.

the length of the last line from the file

Question # 14

What is the expected output of the following snippet?

PCAP-31-03 question answer

A.

abc

B.

The code will cause a runtime exception

C.

ABC

D.

123

Question # 15

What is the expected behavior of the following code?

PCAP-31-03 question answer

A.

it outputs 1

B.

it outputs 2

C.

the code is erroneous and it will not execute

D.

it outputs 3

Question # 16

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

Question # 17

What is the expected output of the following code?

PCAP-31-03 question answer

A.

3

B.

5

C.

4

D.

an exception is raised

Question # 18

Assuming that the math module has been successfully imported, which of the following expressions evaluate to True? (Select two answers)

A.

math. hypot (3,4) == math.sqrt (25)

B.

math. hypot (2,5) == math.truec (2.5)

C.

math. hypot (2,5) == math.true (2.5)

D.

math. cell (2,5) == math.floor (2.5)

Question # 19

What is the expected behavior of the following code?

PCAP-31-03 question answer

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]

Question # 20

What is the expected behavior of the following code?

PCAP-31-03 question answer

It will:

A.

print 4321

B.

print

C.

cause a runtime exception

D.

print 1234

Question # 21

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

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

Question # 22

Which of the equations are True? (Select two answers)

A.

chr (ord (x)) = = x

B.

ord (ord (x)) = = x

C.

chr (chr (x)) = = x

D.

ord (chr (x)) = = x

Question # 23

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

A.

lambda X : None

B.

lambda : 3,1415

C.

lambda x : def fun(x): return x

D.

lambda lambda: lambda * lambda

Question # 24

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

PCAP-31-03 question answer

A.

len(a)== len (b)

B.

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

C.

a[0] = b[0]

D.

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

Question # 25

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

PCAP-31-03 question answer

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

Question # 26

What is the expected behavior of the following code?

PCAP-31-03 question answer

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

Question # 27

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

A.

- -

B.

++

C.

<<

D.

>>

Question # 28

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

PCAP-31-03 question answer

A.

is instance(obj_b,C)

B.

C._C__VarA == 2

C.

has atr (B, 'get')

D.

obj_c.get() == 2

Question # 29

What is the expected behavior of the following code?

x = 8 ** (1/3)

y = 2. if x < 2.3 else 3.

print(y)

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

Question # 30

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

Question # 31

What is the expected behavior of the following code?

PCAP-31-03 question answer

A.

it outputs 2

B.

the code is erroneous and it will not execute

C.

it outputs 3

D.

it outputs :

Question # 32

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

Expected output:

PCAP-31-03 question answer

A.

s.split ()

B.

split (s, "˜ "˜)

C.

s.split ("˜ "˜)

D.

split (s)

Question # 33

What will be the value of the i variable when the while e loop finishes its execution?

PCAP-31-03 question answer

A.

1

B.

0

C.

2

D.

the variable becomes unavailable

Question # 34

What is the expected output of the following snippet?

PCAP-31-03 question answer

A.

3

B.

1

C.

2

D.

the code is erroneous

Question # 35

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)

PCAP-31-03 question answer

A.

put self.store(1])

B.

self put stire(1])

C.

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

D.

self .put (self.store[1])

Question # 36

Python's built-in function named open () tries to open a file and returns:

A.

an integer value identifying an opened file

B.

an error code (0 means success)

C.

a stream object

D.

always None

Question # 37

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

services. cpython-36.pyc

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

Question # 38

Which of the following snippets will execute without raising any unhandled exceptions? (Select answers)

A)

PCAP-31-03 question answer

B)

PCAP-31-03 question answer

C)

PCAP-31-03 question answer

D)

PCAP-31-03 question answer

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question # 39

What is the expected behavior of the following snippet?

PCAP-31-03 question answer

It will:

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

Question # 40

There is a stream named s open for writing. What option will you select to write a line to the stream''

A.

s.write("Hello\n")

B.

write(s, "Hello")

C.

s.writeln("Hello")

D.

s.writeline("Hello")

Question # 41

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

A.

open () requires a second argument

B.

open () is a function which returns an object that represents a physical file

C.

instd, outstd, errstd are the names of pre-opened streams

D.

if invoking open () fails, an exception is raised

Question # 42

You are going to read just one character from a stream called s. Which statement would you use?

A.

ch = read(s, 1)

B.

ch = s. input(1)

C.

ch = input(s, 1)

D.

ch = s. read(l)

Question # 43

What is the expected behavior of the following code?

PCAP-31-03 question answer

A.

it outputs 1

B.

it outputs 0

C.

it raises an exception

D.

it outputs 2

Question # 44

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

PCAP-31-03 question answer

A.

a is not None

B.

a ! =b

C.

b () ==4

D.

a () == 4

Question # 45

What is true about the __based__attribute in Python?

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

Question # 46

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)

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

PCAP-31-03 PDF

$33

$109.99

3 Months Free Update

  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions

PCAP-31-03 PDF + Testing Engine

$52.8

$175.99

3 Months Free Update

  • Exam Name: Certified Associate in Python Programming
  • Last Update: Dec 15, 2025
  • Questions and Answers: 154
  • Free Real Questions Demo
  • Recommended by Industry Experts
  • Best Economical Package
  • Immediate Access

PCAP-31-03 Engine

$39.6

$131.99

3 Months Free Update

  • Best Testing Engine
  • One Click installation
  • Recommended by Teachers
  • Easy to use
  • 3 Modes of Learning
  • State of Art Technology
  • 100% Real Questions included