AMAADOR ACADEMYCertificatesVerify a certificate

PCEP

Final check — PCEP Certified Entry-Level Python Programmer (PCEP-30-03): Exam Prep

Answer the 42 questions. You need 80% or more to pass. You can retry as many times as you like.

Study the course →

Question 1According to the Python Institute's PCEP-30-03 syllabus page, what is the exam format?
Question 2A trainee proposes four names for a variable that stores a running total. Which one is valid in Python?
Question 3A colleague writes limit = 1e3 and says limit is an integer. What is the actual type of limit?
Question 4A script prints a welcome line on line 1. On line 5 it runs print(totl), but no variable totl was ever assigned. The file has no syntax errors. What happens when it runs?
Question 5What does the expression 0.1 + 0.2 == 0.3 evaluate to in Python?
Question 6What is the result of -7 // 2 in Python?
Question 7An analyst computes a growth factor with the expression 2 ** 3 ** 2. What value does Python give?
Question 8A report script runs print('A', 'B', 'C', sep='-', end='!'). What appears on screen?
Question 9A program runs x = input('n: ') and the user types 7. The next line is print(x * 2). What is printed?
Question 10What is the value of 10 % 3 + 2 * 2 ** 2?
Question 11A form handler sets name = 0 or 'guest' to pick a default user name. What value does name receive?
Question 12A grading script reads: if mark >= 50: print('pass'), then elif mark >= 70: print('merit'), then else: print('fail'). With mark = 75, what is printed?
Question 13A batch job uses for i in range(2, 11, 3). How many times does the loop body run?
Question 14A loop runs for i in range(5). Its body first checks if i == 3 and, if so, runs break. Otherwise it then runs print(i, end=' '). What is printed?
Question 15A loop runs for i in range(4). If i == 2 it runs continue; after that check it runs print(i, end=' '). What is printed?
Question 16A stock counter starts with x = 10 and runs while x > 3: x -= 4. What is the value of x after the loop?
Question 17count starts at 0. An outer loop for i in range(3) contains an inner loop for j in range(4) whose body is count += 1. What is count at the end?
Question 18Which values does range(5, 0, -2) produce?
Question 19A data cleaner has nums = [4, 8, 15, 16, 23, 42]. What is nums[1:5:2]?
Question 20A script runs a = [1, 2], then b = a, then b.append(3), then print(a). What is printed?
Question 21A developer writes x = [3, 1, 2], then y = x.sort(), then print(y). What is printed?
Question 22Which line creates a tuple that holds exactly one element?
Question 23A data cleaner runs ids = {3, 1, 3, 2, 1}, then print(len(ids)). What is printed?
Question 24A seating plan is stored as grid = [[1, 2], [3, 4], [5, 6]]. What does print(grid[2][0] + len(grid)) show?
Question 25A script runs d = {'a': 1, 'b': 2}, then d['a'] = 3 and d['c'] = 4, then print(len(d), d['a']). What is printed?
Question 26With d = {'a': 1, 'b': 2}, a script runs print('a' in d, 2 in d). What is printed?
Question 27An import script holds s = ' Data,Python ,AI ' and runs print(s.strip().split(',')). What is printed?
Question 28What does 'banana'.find('n') return?
Question 29An invoice script runs total = 3 * 2.5, then print(f'Total: {total:.2f}'). What is printed?
Question 30What does '{1}-{0}'.format('x', 'y') return?
Question 31A pricing module defines def f(a, b=2): return a * b. What does print(f(3), f(3, 3)) show?
Question 32A script defines def show(): print('hi'), then runs r = show() and print(r). What appears on screen?
Question 33A logging helper is defined as def total(*args): return len(args). What does print(total(4, 5, 6)) show?
Question 34Which function header raises a SyntaxError?
Question 35A module sets x = 5 at top level and defines def g(): x = 9; return x. What does print(g(), x) show?
Question 36A validator runs try: print(int('4a')), with except ZeroDivisionError: print('Z') and then except ValueError: print('V'). What is printed?
Question 37A script runs try: n = [1, 2][2], with only except ValueError: print('A'). After the try statement it runs print('end'). What happens?
Question 38A script opens report.txt, which already holds 20 lines, with mode 'w'. It writes one line and closes the file. How many lines does the file now contain?
Question 39What type are the fields in each row returned by csv.reader?
Question 40A rounding check runs import math, then print(math.floor(-3.2), math.trunc(-3.2)). What is printed?
Question 41A tester calls random.seed(7) and records three values of random.random(). The next day she runs the same script again with the same seed. What does she get?
Question 42A script starts with import math as m and later runs print(math.sqrt(9)). What happens?