python institute pcap-31-03 practice test

Exam Title: Certified Associate in Python Programming

Last update: Nov 27 ,2025
Question 1

What is the expected behavior of the following code?

  • A. it outputs error
  • B. it outputs list assignment index out of range
  • C. the code is erroneous and it will not execute
  • D. it outputs <class ' IndexError’ >
Answer:

B


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 2

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

  • A. len('\'•) == 1
  • B. len(""" """) == o
  • C. chr(ordCA') + 1) == 'B'
  • D. ord("Z") - ord("z") -- ord("0")
Answer:

B


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 3

What is the expected behavior of the following code?

  • A. it raises an exception
  • B. it outputs True
  • C. it outputs False
  • D. it outputs nothing
Answer:

B


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 4

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

  • A. 121 + 1 != '!' + 2 * '2'
  • B. 'AbC' lower () < 'AB'
  • C. '1' + '1' + '1' < '1' * 3'
  • D. '3.14' != str(3.1415)
Answer:

A, D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 5

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

  • A. str(1-1) in '012345£739'[:2]
  • B. 'phd' in 'alpha'
  • C. 'deb' not in 'abcde' [::-1]
  • D. 'True' not in 'False'
Answer:

C, D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 6

Which of the following invocations are valid? (Select two answers)

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

B, D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 7

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

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

B, C


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 8

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

  • 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
Answer:

B, D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 9

What is the expected behavior of the following code?

  • A. it outputs 'None'
  • B. it outputs 3
  • C. it raises an exception
  • D. it outputs 0
Answer:

D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 10

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)

  • A. str(Object) == 'Object'
  • B. _name == _main_'
  • C. ClassA. _module_ == 'ClassA'
  • D. len(ClassB.__bases__) == 1
Answer:

B, D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Page 1 out of 14
Viewing questions 1-10 out of 147
Go To
page 2