Free preview mode

Enjoy the free questions and consider upgrading to gain full access!

PCEP-30-02Free trialFree trial

By python-institute
Aug, 2025

Verified

25Q per page

Question 26

Take a look at the snippet and choose one of the following statements which is true:

Image 1
  • A: vals is longer than nums
  • B: nums and vals are of the same length
  • C: nums is longer than vals

Question 27

What is the expected output of the following code?

Image 1
  • A: (1, 2)
  • B: The code is erroneous.
  • C: {'a':1, 'b':2}
  • D: [1,2]

Question 28

How many elements does the L list contain?

Image 1
  • A: one
  • B: two
  • C: three
  • D: zero

Question 29

What is the output of the following snippet?

Image 1
  • A: 1
  • B: 0
  • C: 6

Question 30

What is the expected output of the following code?

Image 1
  • A: ('Peter', 'Peter',)
  • B: PeterPeter
  • C: The code is erroneous.
  • D: ('Peter')
  • E: ()

Question 31

What is the expected output of the following code?

Image 1
  • A: The program will cause an error.
  • B: (1, 4, 9)
  • C: ('A', 'D', 'Z')
  • D: (5.0, 7.5, 9.9)

Question 32

What is the expected output of the following code?

Image 1
  • A: The code is erroneous.
  • B: 1
  • C: 0
  • D: None

Question 33

What is the expected output of the following code?

Image 1
  • A: 22
  • B: 12
  • C: 0
  • D: 11

Question 34

What is the expected output of the following code?

Image 1
  • A: [1, 3]
  • B: [1, 4]
  • C: [4, 3]
  • D: [1, 3, 4]

Question 35

What is the expected output of the following code?

Image 1
  • A: (2, 1, 1)
  • B: (1, 1, 1)
  • C: (2, 2, 2)
  • D: The code is erroneous.

Question 36

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

Image 1

Code:

Image 2
  • A: sorted(list)
  • B: sort(list)
  • C: list.sort()
  • D: list.sorted()

Question 37

Which of the following sentences are true about the code? (Choose two.)

Image 1
  • A: nums and vals are different lists
  • B: vals is longer than nums
  • C: nums and vals are different names of the same list
  • D: nums and vals have the same length

Question 38

The second assignment:

Image 1
  • A: extends the list
  • B: doesn't change the list's length
  • C: shortens the list

Question 39

What is the expected output of the following code?

Image 1
  • A: efg
  • B: abc
  • C: def
  • D: The code is erroneous.
  • E: abcde
  • F: None of the above.

Question 40

Which function does in-place reversal of objects in a list?

  • A: list.sort([func])
  • B: list.pop(obj=list[-1])
  • C: list.remove(obj)
  • D: list.reverse()

Question 41

What is the output of the following snippet?

Image 1
  • A: [1, 2, 3]
  • B: [3, 3, 3]
  • C: [3, 2, 1]
  • D: [1, 1, 1]

Question 42

What snippet would you insert in the line indicated below to print The highest number is 10 and the lowest number is 1. to the monitor?

Image 1
  • A: None of the above.
  • B:
  • C:
  • D:

Question 43

What is the output of the following snippet?

Image 1
  • A: ['Mary', 'had', 'a', 'little', 'lamb']
  • B: ['Mary', 'had', 'a', 'lamb']
  • C: ['Mary', 'had', 'a', 'ramb']
  • D: No output, the snippet is erroneous

Question 44

What is the expected output of the following code?

Image 1
  • A: Paul
  • B: Mary
  • C: The code is erroneous.
  • D: None of the above.
  • E: Peter

Question 45

What is the expected output of the following code?

Image 1
  • A: ['Peter', 404, 3.03, 'Wellert', 33.3]
  • B: None of the above.
  • C: [404, 3.03]
  • D: ['Peter', 'Wellert']

Question 46

What is the expected output of the following code?

Image 1
  • A: 1
  • B: 4
  • C: 3
  • D: 2

Question 47

What is the expected output of the following code?

Image 1
  • A: 0
  • B: 1
  • C: The code is erroneous.
  • D: 2

Question 48

What is the expected output of the following code?

Image 1
  • A: The code is erroneous.
  • B: ['Peter', 'Jane', 'Mary']
  • C: ['Peter', 'Jane']
  • D: ['Paul', 'Mary', 'Jane']

Question 49

What is the expected output of the following code?

Image 1
  • A: 2 4
  • B: 1 3
  • C: 3 1
  • D: 4 2

Question 50

What is the expected output of the following code?

Image 1
  • A: 4
  • B: 10
  • C: Nothing gets printed.
  • D: The code is erroneous.
Page 2 of 14 • Questions 26-50 of 331

Free preview mode

Enjoy the free questions and consider upgrading to gain full access!