PCEP-30-02 Practice Test

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

Question 61

What code would you insert instead of the comment to obtain the expected output? Expected output: Code:

  1. print(k[0])
  2. print(k)
  3. print(k['0'])
  4. print(k["0"])

Question 62

What is the expected output of the following code?

  1. 1 5 9 13
  2. 1 2 3 4
  3. 13 14 15 16
  4. 4 8 12 16

Question 63

What is the expected output of the following code?

  1. The code is erroneous.
  2. 2
  3. 1
  4. 0

Question 64

What is the expected output of the following code?

  1. [2]
  2. [3, 4, 5]
  3. The program will cause an error.
  4. [2, 3, 4, 5]

Question 65

You develop a Python application for your company. A list named employees contains 200 employee names, the last five being company management. You need to slice the list to display all employees excluding management. Which code segments can you use? (Choose two.)

  1. employees[1:-5]
  2. employees[0:-5]
  3. employees[:-5]
  4. employees[0:-4]
  5. employees[1:-4]