18+ practice questions focused on Computer Programming and Python Fundamentals — one of the most tested topics on the Certified Entry-Level Python Programmer PCEP exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Computer Programming and Python Fundamentals PracticeA developer writes a script that prompts the user for their age and stores it in a variable. Which code snippet correctly converts the input to an integer?
Explanation: It uses the `int()` function to convert the string returned by `input()` into an integer. The `input()` function always returns a string, so wrapping it with `int()` performs the type conversion needed for numeric operations.
Given the code: a = [1, 2, 3]; b = a; b.append(4). What is the value of a?
Explanation: In Python, variables hold references to objects, not copies. When `b = a` is executed, both `a` and `b` point to the same list object in memory. The `append()` method modifies the list in-place, so the change is visible through both references. Thus, `a` becomes `[1, 2, 3, 4]`.
A student writes the code: x = 10; if x > 5: print("big"); else: print("small"). What is the output?
Explanation: The code `x = 10; if x > 5: print("big"); else: print("small")` is syntactically correct in Python. Since `x` is 10, the condition `x > 5` evaluates to `True`, so the `if` branch executes, printing `"big"`. The semicolons are allowed as statement separators, and the colon after `if` and `else` is required. Therefore, option D is correct.
Which TWO of the following code snippets will result in a SyntaxError? (Choose two.)
Explanation: Causes a SyntaxError because the `if` statement is missing a colon (`:`) after the condition, which is required for compound statements. Options A, B, C, and E are all valid Python 3 syntax. Option A uses multiple statements on one line with a semicolon. Option B calls the `print()` function correctly. Option C correctly uses a colon and indentation for the `for` loop. Option E correctly uses a colon for the `if` statement. Therefore, only D is a SyntaxError.
A system administrator is writing a Python script to monitor disk usage. The script uses the psutil library (not part of PCEP scope, but the scenario is generic). The administrator writes: import psutil disk = psutil.disk_usage('/') print(disk.free) But the script fails with an ImportError because psutil is not installed. The administrator decides to handle this gracefully: if the module is missing, the script should print a custom error message and exit without crashing. Which code snippet achieves this?
Explanation: It uses a try-except block to catch the ImportError specifically when the import statement fails. This allows the script to print a custom error message and then call sys.exit(1) to terminate gracefully with a non-zero exit code, which is the standard way to signal failure in a script. The other options either do not handle the missing module correctly or fail to exit the script properly.
+13 more Computer Programming and Python Fundamentals questions available
Practice all Computer Programming and Python Fundamentals questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Computer Programming and Python Fundamentals. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Computer Programming and Python Fundamentals questions on the PCEP frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Computer Programming and Python Fundamentals is tested as part of the Certified Entry-Level Python Programmer PCEP blueprint. Practicing with targeted Computer Programming and Python Fundamentals questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free PCEP practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Computer Programming and Python Fundamentals is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Computer Programming and Python Fundamentals practice session with instant scoring and detailed explanations.
Start Computer Programming and Python Fundamentals Practice →