PCEP-30-02 Exam Questions
392 real PCEP-30-02 exam questions with expert-verified answers and explanations. Page 7 of 8.
- Question #301
What is the expected output of the following code? x = (1, 4, 7, 9, 10, 11) y = {2: 'A', 4: 'B', 6: 'C', 8: 'D', 10: 'E', 12: 'F'} res = 1 for z in x: if z in y: res += z print(res...
- Question #302
What would you insert instead of ???, so that the program prints TRUE to the monitor? w = 7 x = 3 y = 4 z = True a = w + x * y b = w + x / z if ???: print('TRUE') else: print('FALS...
- Question #303
How many stars will the following snippet send to the console? i = 2 while i >= 0: print("*") i -= 2
- Question #304
The ABC Video company needs a way to determine the cost that a customer will pay for renting a DVD. The cost is dependent on the time of day the DVD is returned. However, there are...
- Question #305
How many stars will the following code print to the monitor? i = 0 while i < i + 2: i += 1 print('*') else: print('*')
- Question #306
How many stars will the following code send to the monitor? x = 0 while x < 6: x += 1 if x % 2 == 0: continue print('*')
- Question #307
How many stars (*) will the following code output to the screen? n = 1 if n == 1: print("*") if n == True: print("**") if n == False: print("***")
- Question #308
How many stars will the following code print to the monitor? ```python x = 1 while x < 10: print('*') x = x << 1 ```
- Question #309
How many stars will the following snippet print to the monitor? ```python i = 0 while i <= 5: i += 1 if i % 2 == 0: break print('*') ```
- Question #310
Which of the following sentences correctly describes the output of the below Python code? ```python data = [4, 2, 3, 2, 1] res = data[0] for d in data: if d < res: res = d print(re...
- Question #311
Consider the following code. ```python for n in range(1, 6, 1): print(??? * 5) ``` What would you insert instead of ???, so that the program prints the following pattern to the mon...
- Question #312
What is the expected output of the following code? ```python data = [1, 2, [3, 4], [5, 6], 7, [8, 9]] count = 0 for i in range(len(data)): if type(data[i]) == list: count += 1 prin...
- Question #313
How many stars will the following snippet send to the console? ```python for i in range(-1, 1): print('**') ```
- Question #314
You are coding a math utility by using Python. You are writing a function to compute roots. The function must meet the following requirements: - If a is non-negative, return a ** (...
- Question #315
How many stars will the following snippet print to the monitor? ```python for i in range(1): print('*') else: print('**') ```
- Question #316
Which one of the lines should you put in the snippet below to match the expected output? Expected output: `adam_smit` Code: ```python for ch in "[email protected]": if ch == "@...
- Question #317
Consider the following code. ```python data = ['Peter', 'Paul', 'Mary', 'Jane'] res = 0 ``` Which of the following code snippets will expand the code, so that 100 will be printed t...
- Question #318
The following is a program to validate customer numbers. ```python customer_number = input('Enter the employee number (dd-ddd-dddd): ') parts = customer_number.split('-') valid = F...
- Question #319
What is the expected output of the following code? marks = [80, 70, 90, 90, 80, 100] average = sum(marks) // len(marks) grade = '' if 90 <= average <= 100: grade = 'A' elif 80 <= a...
- Question #320
You are developing a Python application for an online product distribution company. You need the program to iterate through a list of products and escape when a target product ID i...
- Question #321
Consider the following code. nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] x = 0 while x < 10: print(nums(x)) # Line 4 if nums[x] == 7: # Line 5 break else: x += 1 You want to print the n...
- Question #322
How many stars ('*') will the following code output to the screen? n = 0 if n > 0: print("**") elif n == True: print("***") else: print("****")
- Question #323
What is the expected output of the following code? Print(len([i for i in range(0, -2)]))
- Question #324
What is the expected output of the following code? my_list = [[3-i for i in range(3)] for j in range(3)] result = 0 for i in range(3): result += my_list[i][i] print(result)
- Question #325
How many stars will the following snippet print to the monitor? data = [[x for x in range(y)] for y in range(3)] for d in data: if len(d) < 2: print('*')
- Question #326
How many stars will the following snippet print to the monitor? x = 16 while x > 0: print('**') x //= 2
- Question #327
The ABC company is creating a program that allows customers to log the number of miles biked. The program will send messages based on how many miles the customer logs. You create t...
- Question #328
What is the expected output of the following code? data = [1, {}, (2, ), (), { }, [4, 5]] points = 0 for i in range(len(data)): if type(data[i]) == list: points += 1 elif type(data...
- Question #329
Which of the following inputs will get the user a discount of 5%? day = input('Enter the day of the week:') discount = 3 if day == 'Wednesday': discount += 5 elif day == 'Thursday'...
- Question #330
How many elements will the following list contain? data = [i for i in range(-1, 2)]
- Question #331
Consider the following code. for i in range(5, 0, ???): print(i, i, i, i, i) What would you insert instead of ???, so that the program prints the following pattern to the monitor?...
- Question #332
Which of the following code snippets will print all prime numbers between 2 and 100 to the monitor?
- Question #333
Consider the following code. x = 42 y = 7 data = "I'm gonna make him an offer he can't refuse." Which of the following expressions will evaluate to 19?
- Question #334
You are designing a decision structure to convert a student's numeric grade to a letter grade. The program must assign a letter grade as specified as followed: 90 through 100 -> A...
- Question #335
The ABC company needs a way to find the count of particular letters in their publications to ensure that there is a good balance. It seems that there have been complaints about ove...
- Question #336
Which one of the lines should you put in the snippet below to match the expected output? Expected output: 1245 Code: c = 0 while c < 5: c = c + 1 if c == 3: # enter code here print...
- Question #337
How many stars will the following code print to the monitor? data = [[x for x in range(3)] for y in range(3)] for i in range(3): for j in range(3): if data[i][j] % 2 != 0: print('*...
- Question #338
A set of elementary operations that can be performed by a CPU is called:
- Question #339
A process in which the source code is immediately executed without the need to translate it into machine code is called:
- Question #340
What is the expected output of the following code? counter = 84 // 2 if counter < 0: print("*") elif counter >- 42: print("**") else: print("***")
- Question #341
What happens when the user runs the following code? total = 0 for i in range(4): if 2 * i < 4: total += 1 else: total += 1 print(total)
- Question #342
What is the expected output of the following code? equals = 0 for i in range(2): for j in range(2): if i == j: equals += 1 else: equals += 1 print(equals)
- Question #343
What happens when the user runs the following code? speed = 0 while speed < 30: speed *= 2 if speed > 10: continue print("*", end="") else: print("**")
- Question #344
What is the expected result of the following code? ```python rates = (1.2, 1.4, 1.0) new = rates[3:] for rate in rates[-2:]: new += (rate,) print(len(new)) ```
- Question #345
Assuming that the following assignment has been successfully executed: `the_list = ['list', False, 3e8]` Which of the following expressions evaluate to True? (Choose two.)
- Question #346
What is true about tuples? (Choose two.)
- Question #347
What is the expected output of the following code? ```python collection = [] collection.append(1) collection.insert(0, 2) duplicate = collection duplicate.append(3) print(len(colle...
- Question #348
What is the expected output of the following code? ```python def iterate(end, foo = 0): if end > 0: foo = iterate(end - 1, foo + end) return foo print(iterate(2)) ```
- Question #349
Which of the following functions can be invoked without arguments?
- Question #350
Which of the following are the names of Python passing argument styles? (Choose two.)