Free PCAP Sample Questions — Certified Associate in Python Programming

Free PCAP sample questions for the Certified Associate in Python Programming exam. No account required: study at your own pace.

Want an interactive quiz? Take the full PCAP practice test

Looking for more? Click here to get the full PDF with 53+ practice questions for $10 for offline study and deeper preparation.

Question 1

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

  • A. except Ex1 Ex2:
  • B. except (ex1, Ex2):
  • C. except Ex1, Ex2:
  • D. except Ex1+Ex2:
Show Answer
Correct Answer:
B. except (ex1, Ex2):
Question 2

Which of the following expressions evaluate to True? (Choose two.)

  • A. ord("z") - ord("Z") == ord("0")
  • B. len(""" """) > 0
  • C. chr(ord('a') + 1) == 'B'
  • D. len('\'') == 1
Show Answer
Correct Answer:
  • B. len(""" """) > 0
  • D. len('\'') == 1
Question 3

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
Show Answer
Correct Answer:
  • C. the constructor is a method named __init__
  • D. the constructor must have at least one parameter
Question 4

A function called issubclass (c1, c2) is able to check if:

  • A. c1 and c2 are both subclasses of the same superclass
  • B. c2 is a subclass of c1
  • C. c1 is a subclass of c2
  • D. c1 and c2 are not subclasses of the same superclass
Show Answer
Correct Answer:
C. c1 is a subclass of c2
Question 5

Which of the following statements are true? (Choose two.)

  • A. an escape sequence can be recognized by the / sign put in front of it
  • B. II in ASCII stands for Internal Information
  • C. ASCII is a subset of UNICODE
  • D. a code point is a number assigned to a given character
Show Answer
Correct Answer:
  • C. ASCII is a subset of UNICODE
  • D. a code point is a number assigned to a given character
Question 6

UNICODE is:

  • A. the name of an operating system
  • B. a standard for encoding and handling texts
  • C. the name of a programming language
  • D. the name of a text processor
Show Answer
Correct Answer:
B. a standard for encoding and handling texts
Question 7

Assuming that the snippet below has been executed successfully, which of the following expressions evaluate to True? (Choose two.) string = 'python'[::2] string = string[-1] + string[-2]

  • A. string[0] == 'o'
  • B. string is None
  • C. len(string) == 3
  • D. string[0] == string [-1]
Show Answer
Correct Answer:
A. string[0] == 'o'
Question 8

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
Show Answer
Correct Answer:
C. a stream object
Question 9

Which of the following expressions evaluate to True? (Choose two.)

  • A. str(1-1) in '123456789'[:2]
  • B. 'dcb' not in 'abcde'[::-1]
  • C. 'phd' in 'aplpha'
  • D. 'True' not in 'False'
Show Answer
Correct Answer:
  • A. str(1-1) in '123456789'[:2]
  • D. 'True' not in 'False'
Question 10

Which of the following invocations are valid? (Choose two.)

  • A. "python".sort()
  • B. sorted("python")
  • C. rfind("python","r")
  • D. "python".index("th")
Show Answer
Correct Answer:
  • B. sorted("python")
  • D. "python".index("th")
Question 11

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")
Show Answer
Correct Answer:
A. s. write ("Hello\n")
Question 12

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

  • 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
Show Answer
Correct Answer:
D. lambda x, y: x ** y
Question 13

Which of the following statements are true? (Choose two.)

  • A. II in ACII stands for Information Interchange
  • B. a code point is a number assigned to a given character
  • C. ACII is synonymous with UTF-8
  • D. \e is an escape sequence used to mark the end of lines
Show Answer
Correct Answer:
  • A. II in ACII stands for Information Interchange
  • B. a code point is a number assigned to a given character
Question 14

Which of the following words can be used as a variable name? (Choose two.)

  • A. for
  • B. True
  • C. true
  • D. For
Show Answer
Correct Answer:
  • C. true
  • D. For
Question 15

Package source directories/folders can be:

  • A. converted into the so-called pypck format
  • B. packed as a ZIP file and distributed as one file
  • C. rebuilt to a flat form and distributed as one directory/folder
  • D. removed as Python compiles them into an internal portable format
Show Answer
Correct Answer:
B. packed as a ZIP file and distributed as one file

Aced these? Get the Full Exam

Download the complete PCAP study bundle with 53+ questions in a single printable PDF.