PCEP-30-02 Practice Test

PCEP-30-02 Practice Test practice questions, page 3 of 20, with answer review and explanations.

Question 11

What is the output of the following snippet?

  1. two
  2. one
  3. (‘one’, ‘two’, ‘three’)
  4. three

Question 12

What is the expected output of the following code?

  1. [3, 1, 25, 5, 20, 5, 4]
  2. [1, 3, 4, 5, 20, 5, 25]
  3. [3, 5, 20, 5, 25, 1, 3]
  4. [1, 3, 3, 4, 5, 5, 20, 25]
  5. [3, 4, 5, 20, 5, 25, 1, 3]

Question 13

Which of the following sentences is true?

  1. str1 and str2 are different (but equal) strings.
  2. str1 and str2 are different names of the same strings.
  3. str1 is longer than str2
  4. str2 is longer than str1

Question 14

The fact that tuples belong to sequence types means:

  1. they can be modified using the del instruction
  2. they can be extended using the .append() method
  3. they are actually lists
  4. they can be indexed and sliced like lists

Question 15

What is the output of the following code?

  1. [1, 1, 1]
  2. [3, -1, 1]
  3. [3, 1, 1]