PCEP-30-02 Exam Questions
392 real PCEP-30-02 exam questions with expert-verified answers and explanations. Page 4 of 8.
- Question #151
What do you call a le containing a program written in a high-level programming language?
- Question #152
Which one of the following is an example of a Python le extension?
- Question #153
What is source code?
- Question #154
What is the expected output of the following code? ``` num = 2 + 3 * 5 print(Num) ```
- Question #155
The folder created by Python used to store pyc les is named:
- Question #156
You develop a Python application for your company. You want to add notes to your code so other team members will understand it. What should you do?
- Question #157
What is the expected behavior of the following program? ```python print("Hello!") ```
- Question #158
UNICODE is a standard:
- Question #159
By which variable of the sys module can we access command line arguments?
- Question #160
What is the expected output of the following code? ```python def func(data): for d in data[::2]: yield d for x in func('abcdef'): print(x, end='') ```
- Question #161
What is the default return value for a function that does not explicitly return any value?
- Question #162
A function denition starts with the keyword:
- Question #163
The function body is missing. What snippet would you insert in the line indicated below: ```python 1 def func(number): 2 # insert your code here 3 4 print(func(7)) ```
- Question #164
What is the expected output of the following code? ```python def func(num): res = '' for _ in range(num): res += '*' return res for x in func(2): print(x, end='') ```
- Question #165
If a list passed into a function as an argument, deleting any of its elements inside the function using the del instruction:
- Question #166
What is the output of the following code snippet? ```python def test(x=1, y=2): x = x + y y += 1 print(x, y) test(2, 1) ```
- Question #167
isainum() checks if a string contains only letters and digits, and this is:
- Question #168
What is the output of the following snippet? ```python def fun(x, y, z): return x + 2 * y + 3 * z print(fun(0, z=1, y=3)) ```
- Question #169
What is the expected output of the following code? ```python def fun(): return True x = fun(false) print(x) ```
- Question #170
What is the expected output of the following code? ```python num = 1 def func(): num = num + 3 print(num) func() print(num) ```
- Question #171
What is the expected output of the following code? ```python def func(p1, p2): p1 = 1 p2[0] = 42 x = 3 y = [1, 2, 3] func(x, y) print(x, y[0]) ```
- Question #172
Which of the following lines correctly invoke the function defined below: (Choose two.) ```python def fun(a, b, c=0): # Body of the function. ```
- Question #173
What is the output of the following snippet? ```python def fun(x): x += 1 return x x = 2 x = fun(x + 1) print(x) ```
- Question #174
What is the expected output of the following code? ```python def func1(param): return param def func2(param): return param * 2 def func3(param): return param + 3 print(func1(func2(...
- Question #175
What is the expected behavior of the following snippet? ```python x = 1 def a(x): return 2 * x x = 2 + a(x) # Line 8 print(a(x)) # Line 9 ```
- Question #176
What does the following code do? ```python def a(b, c, d): pass ```
- Question #177
What is the expected output of the following code? ```python def func1(x): return str(x) def func2(x): return str(2 * x) print(func1(1) + func2(2)) ```
- Question #178
v = 1 def fun(): global v v = 2 return v print(v)
- Question #179
What is the expected output of the following code? def get_names(): names = ['Peter', 'Paul', 'Mary', 'Jane', 'Steve'] return names[2:] def update_names(names): res = [] for name i...
- Question #180
A way of passing arguments in which the order of the arguments determines the initial parameter's values is referred to as:
- Question #181
Which of the literals below is not a valid function name?
- Question #182
Which of the following enclose the input parameters or arguments of a function?
- Question #183
The following snippet: def func(a, b): return a ** a print(func(2))
- Question #184
What is the expected output of the following code? def func1(a): return a ** a def func2(a): return func1(a) * func1(a) print(func2(2))
- Question #185
What is the expected output of the following code? def fun(): return 3 def add(n): return fun() + n print(add(3))
- Question #186
Which of the following lines properly starts a parameterless function definition?
- Question #187
What is the expected output of the following code? x = 42 def func(): global x print('1. x:', x) x = 23 print('2. x:', x) func() print('3. x:', x)
- Question #188
What is the expected output of the following code? def func(x): if x % 2 == 0: return 1 else: return print(func(func(2)) + 1)
- Question #189
The meaning of a positional argument is determined by:
- Question #190
A built in function is a function which ...
- Question #191
def func(data): data = [7, 23, 42] print('Function scope: ', data) data = ['Peter', 'Paul', 'Mary'] print('Outer scope: ', data)
- Question #192
The following snippet: def func(a, b): return b ** a print(func(b=2, 2))
- Question #193
What is the expected output of the following code? def func(x=2, y=3): return x * y print(func(y=2))
- Question #194
What is the expected output of the following code? people = {} def add_person(index): if index in people: people[index] += 1 else: people[index] = 1 add_person('Peter') add_person(...
- Question #195
Which of the following lines properly starts a function using two parameters, both with zeroed default values?
- Question #196
The following snippet: def function_1(a): return None def function_2(a): return function_1(a) * function_1(a) print(function_2(2))
- Question #197
What is the expected output of the following code? data = {} def func(d, key, value): d[key] = value print(func(data, '1', 'Peter'))
- Question #198
What is the expected output of the following code? def func(message, num=1): print(message * num) func('Hello') func('Welcome', 3)
- Question #199
Which of the following function calls can be used to invoke the below function definition? (Choose three.) def test(a, b, c, d):
- Question #200
What is the expected output of the following code? data = 'abcdefg' def func(text): del text[2] return text print(func(data))