PCEP-30-02 Practice Test

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

Question 81

What is the expected output of the following code? menu = {“bunuelo”: 3.21, “torrijas”: 4.99, “churros”: 1.99} for value in menu.values(): print (str(value) [1], end “”)

  1. nru
  2. The code is eeromeous and cannot be run.
  3. 3.214.991.99
  4. …

Question 82

What is the expected output of the following code?

  1. The code raises an exception and outputs nothing.
  2. 4
  3. 5
  4. 6

Question 83

Assuming that the following assignment has been successfully executed: the_list = [“1”, 1, 1.] Which of the following expressions evaluate to True? (Choose two.)

  1. 1.1 in the_list[1:3]
  2. the_list.index(“1”) in the_list
  3. len(the_list[0:2]) < 3
  4. the_list.index(‘1’) == 0

Question 84

Assuming that the phone_dir dictionary contains name:number pairs, arrange the code boxes to create a valid line of code which retrieves Martin Eden’s phone number, and assigns it to the number variable.

Question 85

What is the expected output of the following code?

  1. The code raises an exception and outputs nothing.
  2. 4
  3. 5
  4. 6