PCAP-31-03 Practice Test

PCAP-31-03 Practice Test practice questions, page 3 of 5, with answer review and explanations.

Question 11

What is the expected behavior of the following code?

  1. it outputs error
  2. it outputs
  3. the code is erroneous and it will not execute
  4. it outputs list assignment index out of range

Question 12

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

  1. ord("0") - ord("9") == 10
  2. len("''") == 2
  3. chr(ord('z') - 1) == 'y'
  4. len(''1234'') == 4

Question 13

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

  1. 'xYz'.lower() > 'XY'
  2. '8'+'8' ! = 2 * '8'
  3. float ('3.14') == str('3.' + '14')
  4. 121 + 1 == int('1' + 2 * '2')

Question 14

What is the expected behavior of the following code?

  1. it outputs 3
  2. it outputs 'None'
  3. it outputs 0
  4. it raises an exception

Question 15

What is the expected behavior of the following code? the_list = "alpha;beta;gamma".split(";") the_string = ''.join(the_list) print(the_string.isalpha())

  1. it outputs True
  2. it outputs False
  3. it outputs nothing
  4. it raises an exception