Loading...

My Learning Pad Login

Welcome

PCEP™ – Certified Entry-Level Python Programmer (Exam PCEP-30-02)

Mock Exam Paper 1 - Answers

Correct Answers and Explanations

Question 1: A - 0b110 is binary 6, 0o7 is octal 7, 6 + 7 = 13.
Question 2: B - return is a Python keyword.
Question 3: A - 3 ** 2 = 9, 9 % 5 = 4.
Question 4: B - Python uses # for each line in multi-line comments.
Question 5: C - 0xF is hex for 15.

Question 6: C - True is a boolean.
Question 7: C - Slicing [1:3] gives at (indices 1 and 2).
Question 8: C - int(4.7) = 4, float("2.3") = 2.3, 4 + 2.3 = 6.3 (wait, options: A is 6.3). Wait, correction: A.
Question 9: C - Variable can't start with digit.
Question 10: A - 4 > 2 (True) or 3 < 1 (False) = True.
Question 11: A - Concatenates to "AB3".

Question 12: A - 6 % 3 = 0, divisible.
Question 13: A - range(2, 6, 3) gives 2, 5.
Question 14: A - Prints 4, 3, 2 (stops at x=1).
Question 15: A - Skips 2, breaks at 4 after printing 0,1,3.
Question 16: B - 9 > 8 true, prints "B".
Question 17: A - Inner loop runs once per i, prints 0,1,2.
Question 18: A - Skips even, prints 1,3.
Question 19: A - not (False or False) = True, prints "Yes".

Question 20: B - 2 * 3 = 6.
Question 21: B - -2 is second last, 5.
Question 22: C - Key "key3" absent, returns "default".
Question 23: B - Local change, y remains 3.
Question 24: A - Sorted [1,5,9], [1] is 5.
Question 25: B - Concatenates to (1,2,3,4), len 4.
Question 26: A - "a" is in dic, True.
Question 27: A - Keyword args, 5 - 2 = 3.
Question 28: A - Appends 30, pops first (10).
Question 29: A - Returns "Done".
Question 30: B - Deletes "x", len 1.