PCEP-30-02 Practice Test

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

Question 76

What is the expected output of the following code?

  1. {(2, 3): 2}
  2. {(1, 2): 1}
  3. The code is erroneous.
  4. 1

Question 77

Take a look at the snippet and choose the true statement:

  1. vals is longer than nums
  2. nums is longer than vals
  3. nums and vals have the same length
  4. The snippet will cause a runtime error.

Question 78

What is the expected output of the following code?

  1. 3
  2. The code is erroneous.
  3. 6
  4. 7

Question 79

What is true about tuples? (Choose two.)

  1. The len() function cannot be applied to tuples.
  2. Tuples are immutable, which means that their contents cannot be changed during their lifetime.
  3. An empty tuple is written as ().
  4. Tuples can be indexed and sliced like lists.

Question 80

Assuming that the following assignment has been successfully executed: my_list = [5, 4, 3, 2] Select the expressions which will not raise any exception. (Choose two.)

  1. my_list[4]
  2. my_list[–5]
  3. my_list[my_list[–1]]
  4. my_list[1:1]