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: 2

Questions 11

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

Questions 12

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 12

Options:
A.

str (Object) = 'Object1

B.

Class A.__module__ == ' main__'

C.

len (ClassB.__bases__) == 2

D.

__name__== '__main__'

Questions 13

What is the expected behavior of the following snippet?

PCAP-31-03 Question 13

It will:

Options:
A.

cause a runtime exception

B.

print 1

C.

print 0 , [1]

D.

print [1J

Questions 14

What is the expected behavior of the following code?

PCAP-31-03 Question 14

Options:
A.

it outputs list assignment index out of range

B.

the code is erroneous and it will not execute

C.

it outputs

D.

it outputs error

Questions 15

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

Options:
A.

\e is an escape sequence used to mark the end of lines

B.

ASCII is synonymous with UTF-8

C.

II in ASCII stands for Information Interchange

D.

a code point is a number assigned to a given character

Questions 16

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 16

Options:
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

Questions 17

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

PCAP-31-03 Question 17

Options:
A.

isinstance (obj_b,A)

B.

A.VarA == 1

C.

obj_a is obj_aa

D.

B.VarA == 1

Questions 18

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

Options:
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

Questions 19

What is the expected behavior of the following code?

PCAP-31-03 Question 19

Options:
A.

it raises an exception

B.

it outputs True

C.

it outputs False

D.

it outputs nothing

Questions 20

What is the expected behavior of the following code?

PCAP-31-03 Question 20

Options:
A.

It outputs 123

B.

it raises an exception

C.

it outputs 321

D.

it outputs 6

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.