PCEP-30-02 Exam Questions
392 real PCEP-30-02 exam questions with expert-verified answers and explanations. Page 2 of 8.
- Question #51
Consider the following list. data = [1, 5, 10, 19, 55, 30, 99] Which of the code snippets below would produce a new list like the following? [1, 5, 10, 99]
- Question #52
What is the expected output of the following code? data1 = 'a', 'b' data2 = ('a', 'b') print(data1 == data2)
- Question #53
l1 = [1, 2, 3] for v in range(len(l1)): l1.insert(1, l1[v]) print(l1)
- Question #54
Insert the correct snippet to convert the t tuple to a dictionary named d. Expected output: {'A': 1, 'B': 2, 'C': 3} Code: t = (('A', 1), ('B', 2), ('C', 3)) # insert code here pri...
- Question #55
How many elements does the my_list list contain? my_list = [0 for i in range(1, 3)]
- Question #56
What is the expected output of the following code? data = {'z': 23, 'x': 7, 'y': 42} for _ in sorted(data): print(data[_], end=' ')
- Question #57
What is the expected output of the following code? x = {(1, 2): 1, (2, 3): 2} print(x[(1, 2)])
- Question #58
Take a look at the snippet and choose the true statement: nums = [1, 2, 3] vals = nums del vals[:]
- Question #59
What is the expected output of the following code? data = {} data[1] = 1 data['1'] = 2 data[1.0] = 4 res = 0 for d in data: res += data[d] print(res)
- Question #60
What would you insert instead of ???, so that the program checks for even numbers? if ???: print('x is an even number')
- Question #61
What value will be assigned to the x variable? z = 3 y = 7 x = y < z and z > y or y > z and z < y
- Question #62
What is the expected output of the following code? x = 1 // 5 + 1 / 5 print(x)
- Question #63
An operator able to check whether two values are not equal is coded as:
- Question #64
The result of the following addition: 123 + 0.0
- Question #65
What will be the output of the following code snippet? print(3 / 5)
- Question #66
What will be the output of the following code snippet? x = 2 y = 1 x *= y + 1 print(x)
- Question #67
What is the expected output of the following code? x = 1 / 2 + 3 // 3 + 4 ** 2 print(x)
- Question #68
You develop a Python application for your company. You have the following code. def main(a, b, c, d): value = a + b * c - d return value Which of the following expressions is equiv...
- Question #69
What is the output of the following code? a = 1 b = 0 x = a or b y = not(a and b) print(x + y)
- Question #70
Which of the following statements are true? (Choose two.)
- Question #71
Which of the following statements is false?
- Question #72
What is the expected output of the following code? x = True y = False x = x or y x = x and y x = x or y print(x, y)
- Question #73
The ** operator:
- Question #74
Only one of the following statements is true - which one?
- Question #75
The + operator, when applied to strings, performs:
- Question #76
What is the expected output of the following code? x = 9 y = 12 result = x // 2 * 2 / 2 + y % 2 ** 3 print(result)
- Question #77
Consider the following code. x = 1 x = x == x The value eventually assigned to x is equal to:
- Question #78
What is the output of the following code? a = 10 b = 20 c = a > b print(not(c))
- Question #79
What is the expected output of the following code? x = 1 + 1 // 2 + 1 / 2 + 2 print(x)
- Question #80
What is the expected output of the following code? print(1 / 1)
- Question #81
What is the expected output of the following code? list1 = [3, 7, 23, 42] list2 = [3, 7, 23, 42] print(list1 is list2) print(list1 == list2)
- Question #82
What is the expected output of the following code? print(3 * "abc" + 'xyz')
- Question #83
What is the expected output of the following code? nums = [3, 7, 23, 42] alphas = ['p', 'p', 'm', '3'] print(nums is alphas) print(nums == alphas) nums = alphas print(nums is alpha...
- Question #84
What would you insert instead of ???, so that the program prints True to the monitor x = 'Peter' y = 'Peter' res = ??? print(res)
- Question #85
What is the expected output of the following code? ```python x, y, z = 3, 2, 1 z, y, x = x, y, z print(x, y, z) ```
- Question #86
What is the data type of x, y, z after executing the following snippet? ```python x = 23 + 42 y = '23' + '42' z = '23' * 7 ```
- Question #87
What is the expected output of the following code? ```python x = 2 y = 6 x += y ** 2 x //= y // 2 // 3 print(x) ```
- Question #88
The result of the following division: ```python 1 / 1 ```
- Question #89
What is the expected output of the following code? ```python res = str(bool(1) + float(12) / float(2)) print(res) ```
- Question #90
What is the expected output of the following code? ```python print('Mike' > 'Mikey') ```
- Question #91
Which of the following is the correct order of operator precedence?
- Question #92
What is the result of the following operation? ```python 1 + 1.0 ```
- Question #93
Consider the following code. ```python languages = ['English', 'Spanish', 'German'] more_languages = ['English', 'Spanish', 'German'] extra_languages = more_languages ``` Which sta...
- Question #94
Which expression evaluates to 7?
- Question #95
What is the output of the following snippet? ```python y = 2 + 3 * 5. print(y) ```
- Question #96
What is the expected output of the following code? ```python list1 = ['Peter', 'Paul', 'Mary', 'Jane'] list2 = ['Peter', 'Paul', 'Mary', 'Jane'] print(list1 is list2) print(list1 =...
- Question #97
Evaluate the following Python arithmetic expression: (3*(1+2) **2-(2**2)*3) What is the result?
- Question #98
What value will be assigned to the x variable? ```python z = 10 y = 0 x = z > y or z == y ```
- Question #99
Consider the following code. ```python x = [0, 1, 2] x[0], x[2] = x[2], x[0] ``` What does the second assignment do?
- Question #100
What will be the output of the following snippet? ``` 1 a = 1 2 b = 0 3 a = a ^ b 4 b = a ^ b 5 a = a ^ b 6 print(a, b) ```