PCEP-30-02 Practice Test

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

Question 26

Which one of the lines should you put in the snippet below to match the expected output? Expected output: Code:

  1. reverse(list)
  2. list.reversed()
  3. list.reverse()
  4. reversed(list)

Question 27

What is the expected output of the following code?

  1. ['1', '2', '3', '4']
  2. (1, 2, 3, 4)
  3. ('1', '2', '3', '4')
  4. The code is erroneous.

Question 28

What is the expected output of the following code?

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

Question 29

What is the output of the following snippet?

  1. -2
  2. 3
  3. -1
  4. 1

Question 30

An alternative name for a data structure called a stack is:

  1. LIFO
  2. FIFO
  3. FOLO