Python Institute PCAP-31-03 Exam
Certified Associate in Python Programming Exam (Page 5 )

Updated On: 12-Jan-2026

If you need to serve two different exceptions called Ex1 and Ex2 in one except branch, you can write:

  1. except Ex1 Ex2:
  2. except (ex1, Ex2):
  3. except Ex1, Ex2:
  4. except Ex1+Ex2:

Answer(s): D



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

  1. chr (ord (x)) = = x
  2. ord (ord (x)) = = x
  3. chr (chr (x)) = = x
  4. ord (chr (x)) = = x

Answer(s): A,D

Explanation:

https://docs.python.org/3/library/functions.html#chr https://docs.python.org/3/library/functions.html#ord



What can you deduce from the following statement? (Select two answers) str = open('file.txt', "rt")

  1. str is a string read in from the file named file.txt
  2. a newlina character translation will be performed during the reads
  3. if file. txt does not exist, it will be created
  4. the opened file cannot be written with the use of the str variable

Answer(s): A,D



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

  1. s.write("Hello\n")
  2. write(s, "Hello")
  3. s.writeln("Hello")
  4. s.writeline("Hello")

Answer(s): A


Reference:

https://en.wikibooks.org/wiki/Python_Programming/Input_and_Output



Select the valid fun () invocations:
(select two answers)
def fun (a, b=0):
return a*b

  1. fun(b=1)
  2. fun (a=0)
  3. fun(b=1, 0)
  4. fun (1)

Answer(s): B,D



Viewing page 5 of 30
Viewing questions 21 - 25 out of 147 questions



Post your Comments and Discuss Python Institute PCAP-31-03 exam prep with other Community members:

Join the PCAP-31-03 Discussion