Free preview mode
Enjoy the free questions and consider upgrading to gain full access!
PCEP-30-02
Free trial
Verified
Question 26
Take a look at the snippet and choose one of the following statements which is true:
- 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?
- 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?
- A: one
- B: two
- C: three
- D: zero
Question 29
What is the output of the following snippet?
- A: 1
- B: 0
- C: 6
Question 30
What is the expected output of the following code?
- A: ('Peter', 'Peter',)
- B: PeterPeter
- C: The code is erroneous.
- D: ('Peter')
- E: ()
Question 31
What is the expected output of the following code?
- 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?
- A: The code is erroneous.
- B: 1
- C: 0
- D: None
Question 33
What is the expected output of the following code?
- A: 22
- B: 12
- C: 0
- D: 11
Question 34
What is the expected output of the following code?
- A: [1, 3]
- B: [1, 4]
- C: [4, 3]
- D: [1, 3, 4]
Question 35
What is the expected output of the following code?
- 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:
Code:
- 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.)
- 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:
- 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?
- 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?
- 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?
- A: None of the above.
- B:
- C:
- D:
Question 43
What is the output of the following snippet?
- 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?
- 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?
- 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?
- A: 1
- B: 4
- C: 3
- D: 2
Question 47
What is the expected output of the following code?
- A: 0
- B: 1
- C: The code is erroneous.
- D: 2
Question 48
What is the expected output of the following code?
- 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?
- A: 2 4
- B: 1 3
- C: 3 1
- D: 4 2
Question 50
What is the expected output of the following code?
- A: 4
- B: 10
- C: Nothing gets printed.
- D: The code is erroneous.
Free preview mode
Enjoy the free questions and consider upgrading to gain full access!