PCEP-30-02 Exam Questions
392 real PCEP-30-02 exam questions with expert-verified answers and explanations. Page 1 of 8.
- Question #1
What is the expected output of the following code? ```python data = ((1, 2,)) * 7 print(len(data[3:8])) ```
- Question #2
What is the expected output of the following code? ```python data = {'Peter': 30, 'Paul': 31} print(list(data.keys())) ```
- Question #3
What is the output of the following snippet? ```python tup = (1, ) + (1, ) tup = tup + tup print(len(tup)) ```
- Question #4
What is the expected output of the following code? ```python data = (1, 2, 4, 8) data = data[-2:-1] data = data[-1] print(data) ```
- Question #5
What is the output of the following snippet? ```python my_list = [1, 2] for v in range(2): my_list.insert(-1, my_list[v]) print(my_list) ```
- Question #6
What is the expected output of the following code? ```python data = [1, 2, 3, None, (), [], [] ] print(len(data)) ```
- Question #7
A data structure described as LIFO is actually a:
- Question #8
How would you remove all the items from the d dictionary? Expected output: ``` {} ``` Code: ```python d = {'A' : 1, 'B' : 2, 'C' : 3} ```
- Question #9
What is the expected output of the following code? ```python data = {'one': 'two', 'two': 'three', 'three': 'one'} res = data['three'] for _ in range(len(data)): res = data[res] pr...
- Question #10
What is the expected output of the following code? ```python data = {'name': 'Peter', 'age': 30} person = data.copy() print(id(data) == id(person)) ```
- Question #11
Which one of the lines should you put in the snippet below to match the expected output? Expected output: ``` [4, 1, 7, 2, 'A'] ``` Code: ```python list = ['A', 2, 7, 1, 4] # enter...
- Question #12
What is the expected output of the following code? ```python data1 = '1', '2' data2 = ('3', '4') print(data1 + data2) ```
- Question #13
An alternative name for a data structure called a stack is:
- Question #14
What is the expected output of the following code? ```python 1 w = [7, 3, 23, 42] 2 x = w[1:] 3 y = w[1:] 4 z = w 5 y[0] = 10 6 z[1] = 20 7 print(w) ```
- Question #15
Take a look at the snippet and choose one of the following statements which is true: ```python 1 nums = [] 2 vals = nums 3 vals.append(1) ```
- Question #16
```python 1 data = {'a': 1, 'b': 2, 'c': 3} 2 print(data['a'], 'b']) ```
- Question #17
How many elements does the L list contain? ```python 1 L = [i for i in range(-1, -2)] ```
- Question #18
What is the output of the following snippet? ```python 1 my_list = [0, 1, 2, 3] 2 x = 1 3 for elem in my_list: 4 x *= elem 5 print(x) ```
- Question #19
What is the expected output of the following code? ```python 1 nums = [1, 2, 3] 2 data = ('Peter', ) * (len(nums) - nums[::-1][0]) 3 print(data) ```
- Question #20
What is the expected output of the following code? ```python 1 t1 = (1, 4, 9) 2 t2 = ('A', 'D', 'Z') 3 t3 = (True, False, None) 4 t4 = (5.0, 7.5, 9.9) 5 6 t1, t3 = t2, t4 7 print(t...
- Question #21
What is the expected output of the following code? ```python 1 data = () 2 print(data.__len__()) ```
- Question #22
```python 1 fruits1 = ['Apple', 'Pear', 'Banana'] 2 fruits2 = fruits1 3 fruits3 = fruits1[:] 4 5 fruits2[0] = 'Cherry' 6 fruits3[1] = 'Orange' 7 8 res = 0 9 10 for i in (fruits1, f...
- Question #23
What is the expected output of the following code? ```python 1 data = (1, ) * 3 2 data[0] = 2 3 print(data) ```
- Question #24
Which one of the lines should you put in the snippet below to match the expected output? Expected output: `[1, 2, 4, 7]` ```python 1 list = [2, 7, 1, 4] 3 # enter code here 5 print...
- Question #25
Which of the following sentences are true about the code? (Choose two.) ```python 1 nums = [1, 2, 3] 2 vals = nums ```
- Question #26
The second assignment: ```python 1 vals = [0, 1, 2] 2 vals[0], vals[1] = vals[1], vals[2] ```
- Question #27
What is the expected output of the following code? ```python 1 data = ['abc', 'def', 'abcde', 'efg'] 2 print(max(data)) ```
- Question #28
Which function does in-place reversal of objects in a list?
- Question #29
What is the output of the following snippet? ```python my_list_1 = [1, 2, 3] my_list_2 = [] for v in my_list_1: my_list_2.insert(0, v) print(my_list_2) ```
- Question #30
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? ```python data = [10, 2, 1, 7, 5, 6, 4, 3,...
- Question #31
What is the output of the following snippet? ```python my_list = ['Mary', 'had', 'a', 'little', 'lamb'] del my_list[3] my_list[3] = 'ram' print(my_list) ```
- Question #32
What is the expected output of the following code? ```python data = ['Peter', 'Paul', 'Mary'] print(data[int(-1 / 2)]) ```
- Question #33
What is the expected output of the following code? ```python data = {1: 0, 2: 1, 3: 2, 0: 1} x = 0 for _ in range(len(data)): x = data[x] print(x) ```
- Question #34
What is the expected output of the following code? ```python list = ['Peter', 'Paul', 'Mary'] def list(data): del data[1] data[1] = 'Jane' return data print(list(list)) ```
- Question #35
What is the expected output of the following code? ```python data = {} data['2'] = [1, 2] data['1'] = [3, 4] for i in data.keys(): print(data[i][i], end=' ') ```
- Question #36
What is the expected output of the following code? ```python data1 = (1, 2) data2 = (3, 4) [print(sum(x)) for x in [data1 + data2]] ```
- Question #37
After execution of the following snippet, the sum of all vals elements will be equal to: ```python vals = [0, 1, 2] vals.insert(0, 1) del vals[1] ```
- Question #38
What is the expected output of the following code? ```python data = set([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) print(len(data)) ```
- Question #39
What is the output of the following snippet? ```python my_list = [x * x for x in range(5)] def fun(lst): del lst[2] return lst print(fun(my_list)) ```
- Question #40
What is the expected output of the following code? a = [1, 2, 3, 4, 5] print(a[3:0:-1])
- Question #41
What is the expected output of the following code? data = {'1': '0', '0': '1'} for d in data.vals(): print(d, end='')
- Question #42
What code would you insert instead of the comment to obtain the expected output? Expected output: a b c dictionary = {} my_list = ['a', 'b', 'c', 'd'] for i in range(len(my_list) -...
- Question #43
What is the expected output of the following code? data = [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16] ] for i in range(0, 4): print(data[i].pop(), end='')
- Question #44
What is the expected output of the following code? data = [[0, 1, 2, 3] for i in range(2)] print(data[2][0])
- Question #45
What is the expected output of the following code? numbers = [1, 2, 3, 4, 5] nums = numbers[2 : ] print(nums)
- Question #46
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...
- Question #47
What is the expected output of the following code? data = [1, 2, 3, 4, 5, 6] for i in range(1, 6): data[i - 1] = data[i] for i in range(0, 6): print(data[i], end='')
- Question #48
What is the expected output of the following code? x = [1, 2, 3, 4, 5, 6, 7, 8, 9] x[::2] = 10, 20, 30, 40, 50, 60 print(x)
- Question #49
What is the expected output of the following code? box = {} jars = {} crates = {} box['biscuit'] = 1 box['cake'] = 3 jars['jam'] = 4 crates['box'] = box crates['jars'] = jars print...
- Question #50
What is the expected output of the following code? data = 'Hello@Peter!!' print(data.lower())