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

PCAP-31-03 Certified Associate in Python Programming Questions and Answers

Questions 4

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'

Buy Now
Questions 5

A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:

Options:

A.

lambda (x, y) = x ** y

B.

lambda (x, y): x ** y

C.

def lambda (x, y): return x ** y

D.

lambda x, y: x ** y

Buy Now
Questions 6

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

string = 'SKY' (:: -1)

string = string (-1)

Options:

A.

string is None

B.

string (0) == string (-1

C.

string (0) == 'Y'

D.

len (string) == 1

Buy Now
Questions 7

What is the output of the following piece of code?

PCAP-31-03 Question 7

Options:

A.

ant'bat'camel

B.

ant"bat"camel

C.

antbatcamel

D.

ant bat camel

Buy Now
Questions 8

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 8

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

Buy Now
Questions 9

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

Options:

A.

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

B.

the second open () argument is optional

C.

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

D.

if invoking open () fails, the value None is returned

Buy Now
Questions 10

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 11

What is the expected output of the following code?

PCAP-31-03 Question 11

Options:

A.

a

B.

an exception is raised

C.

b

D.

c

Buy Now
Questions 12

What is the expected behavior of the following code?

PCAP-31-03 Question 12

Options:

A.

It outputs False

B.

It outputs nothing

C.

It outputs True

D.

It raises an exception

Buy Now
Questions 13

Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True? (Select two answers)

PCAP-31-03 Question 13

Options:

A.

str(Object) == 'Object'

B.

_name == _main_'

C.

ClassA. _module_ == 'ClassA'

D.

len(ClassB.__bases__) == 1

Buy Now
Questions 14

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

Buy Now
Questions 15

What is the expected output of the following snippet?

PCAP-31-03 Question 15

Options:

A.

the code is erroneous

B.

3

C.

7

D.

15

Buy Now
Questions 16

What is the expected behavior of the following code?

PCAP-31-03 Question 16

Options:

A.

it outputs False

B.

it outputs True

C.

it raises an exception

D.

it outputs nothing

Buy Now
Questions 17

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 18

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 19

A class constructor (Select two answers)

Options:

A.

can return a value

B.

cannot be invoked directly from inside the class

C.

can be invoked directly from any of the subclasses

D.

can be invoked directly from any of the superclasses

Buy Now
Questions 20

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

PCAP-31-03 Question 20

Options:

A.

a is b

B.

b( ) > 2

C.

a() > 2

D.

a is not None

Buy Now
Questions 21

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

Options:

A.

121 + 1 != '!' + 2 * '2'

B.

'AbC' lower () < 'AB'

C.

'1' + '1' + '1' < '1' * 3'

D.

'3.14' != str(3.1415)

Buy Now
Questions 22

What is the expected behavior of the following code?

PCAP-31-03 Question 22

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 23

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

PCAP-31-03 Question 23

Options:

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

Buy Now
Questions 24

Which one of the platform module functions should be used to determine the underlying platform name?

Options:

A.

platform.uname ()

B.

platform.platform ()

C.

platform.python_version()

D.

platform.processor()

Buy Now
Questions 25

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

PCAP-31-03 Question 25

Options:

A.

1

B.

0

C.

2

D.

the variable becomes unavailable

Buy Now
Questions 26

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

Options:

A.

'key' in diet

B.

diet['key'] != None

C.

diet.exists('key')

D.

'key' in diet.keys()

Buy Now
Questions 27

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

A)

PCAP-31-03 Question 27

B)

PCAP-31-03 Question 27

C)

PCAP-31-03 Question 27

D)

PCAP-31-03 Question 27

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 28

What is the expected behavior of the following code?

PCAP-31-03 Question 28

It will

Options:

A.

print 2 1

B.

print 1 2

C.

cause a runtime exception

D.

print

Buy Now
Questions 29

What is the expected behavior of the following code?

PCAP-31-03 Question 29

Options:

A.

it outputs 'None'

B.

it outputs 3

C.

it raises an exception

D.

it outputs 0

Buy Now
Questions 30

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

(Select two answers.)

PCAP-31-03 Question 30

Options:

A.

a == b

B.

b {1} == 4

C.

a is not None

D.

a (2) == 4

Buy Now
Questions 31

Assuming that the following code has been executed successfully, selected the expression which evaluate to True (Select two answers)

PCAP-31-03 Question 31

Options:

A.

a ( ) == 4

B.

a is not None

C.

b ( ) == 4

D.

a ! = b

Buy Now
Questions 32

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

Options:

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

Buy Now
Questions 33

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

Options:

A.

ch = read(s, 1)

B.

ch = s. input(1)

C.

ch = input(s, 1)

D.

ch = s. read(l)

Buy Now
Questions 34

What is the expected output of the following snippet?

PCAP-31-03 Question 34

Options:

A.

3

B.

1

C.

2

D.

the code is erroneous

Buy Now
Questions 35

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

PCAP-31-03 Question 35

Options:

A.

BB

B.

CC

C.

AA

D.

BC

Buy Now
Questions 36

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

Options:

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

Buy Now
Questions 37

What is true about Object-Oriented Programming in Python? (Select two answers)

Options:

A.

encapsulation allows you to protect some data from uncontrolled access

B.

the arrows on a class diagram are always directed from a superclass towards its subclass

C.

inheritance is the relation between a superclass and a subclass

D.

an object is a recipe for a class

Buy Now
Questions 38

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

Options:

A.

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

B.

v1 == v2

C.

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

D.

v1 >= 1

Buy Now
Questions 39

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

Buy Now
Questions 40

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

Options:

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

Buy Now
Questions 41

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

Options:

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)

Buy Now
Questions 42

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

PCAP-31-03 Question 42

Options:

A.

len(a)== len (b)

B.

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

C.

a[0] = b[0]

D.

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

Buy Now
Questions 43

What is the expected output of the following snippet?

PCAP-31-03 Question 43

Options:

A.

abc

B.

The code will cause a runtime exception

C.

ABC

D.

123

Buy Now
Questions 44

What is the expected behavior of the following snippet?

PCAP-31-03 Question 44

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 45

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

Options:

A.

Python strings are actually lists

B.

Python strings can be concatenated

C.

Python strings can be sliced like lists

D.

Python strings are mutable

Buy Now
Questions 46

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

Options:

A.

closing an open file is performed by the closefile ( ) function

B.

the second open ( ) argument describes the open mode and defaults to ‘w’

C.

if open ( ) ‘s second argument is ‘r’ the file must exist or open will fail

D.

if open ( )’s second argument is ‘w’ and the invocation succeeds, the previous file’s content is lost

Buy Now
Exam Code: PCAP-31-03
Exam Name: Certified Associate in Python Programming
Last Update: Oct 28, 2025
Questions: 154

PDF + Testing Engine

$63.52  $181.49

Testing Engine

$50.57  $144.49
buy now PCAP-31-03 testing engine

PDF (Q&A)

$43.57  $124.49
buy now PCAP-31-03 pdf