Sign In
Home/Python Institute/PCAP-31-03/Free questions

PCAP-31-03 — Free Practice Questions

10 free sample questions from a bank of 98, with the correct answers and explanations. No signup required — start practising right now.

1What is true about Python packages? (Choose two.)
  • a code designed to initialize a package’s state should be placed inside a file named init.py
  • a package’s contents can be stored and distributed as an mp3 file
  • __pycache__ is a folder that stores semi-compiled Python modules
  • the sys.path variable is a list of strings
Answer: A, C
2What is true about the following snippet? (Choose two.)
PCAP-31-03 question 2
  • the string what a pity will be seen
  • the string it's nice to see you will be seen
  • the code will raise an unhandled exception
  • the string I feel fine will be seen
Answer: B, D
3What is the expected behavior of the following code?
PCAP-31-03 question 3
  • it outputs error
  • it outputs
  • the code is erroneous and it will not execute
  • it outputs list assignment index out of range
Answer: C
4Which of the following expressions evaluate to True? (Choose two.)
  • ord("0") - ord("9") == 10
  • len("''") == 2
  • chr(ord('z') - 1) == 'y'
  • len(''1234'') == 4
Answer: C, D
5What is the expected behavior of the following code? the_list = "alpha;beta;gamma".split(";") the_string = ''.join(the_list) print(the_string.isalpha())
  • it outputs True
  • it outputs False
  • it outputs nothing
  • it raises an exception
Answer: A
6Which of the following invocations are valid? (Choose two.)
  • sort("python")
  • "python".find("")
  • "python".sort()
  • sorted("python")
Answer: B, D
7Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Choose two.) string = 'python'[::2] string = string[-1] + string[-2]
  • len(string) == 3
  • string[0] == 'o'
  • string[0] == string[-1]
  • string is None
Answer: A, B
8Which of the following statements are true? (Choose two.)
  • an escape sequence can be recognized by the / sign put in front of it
  • ASCII is a subset of UNICODE
  • II in ASCII stands for Internal Information
  • a code point is a number assigned to a given character
Answer: B, D
9What is the expected output of the following code? import sys import math b1 = type(dir(math)) is list b2 = type(sys.path) is list print(b1 and b2)
  • None
  • True
  • 0
  • False
Answer: B
10A property that stores information about a given class’s super-classes is named:
  • __bases__
  • __super__
  • __upper__
  • __ancestors__
Answer: A

Want the full bank of 98 questions for PCAP-31-03? See all practice exams.