20+ practice questions focused on Control Flow, Loops, Lists and Logic — 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 Control Flow, Loops, Lists and Logic PracticeA developer writes a loop to sum numbers from 1 to 10. The code outputs 55, but the expected sum is 55. However, the loop uses a range that includes 0. Which range should be used to achieve the correct sum?
Explanation: (range(1,11)) is correct because range(start, stop) generates numbers from start inclusive to stop exclusive. To sum numbers 1 through 10, the range must start at 1 and end at 11 (so 10 is included). The loop that used range(0,11) included 0, but since adding 0 does not change the sum, the output was still 55 — however, the question asks for the range that achieves the correct sum without including unnecessary values.
A programmer needs to iterate over a list of strings and print each string in uppercase. Which loop correctly accomplishes this?
Explanation: Both Option A and Option D correctly iterate over the list and print each string in uppercase. Option A uses enumerate to get each item and calls item.upper() with parentheses, printing the result. Although it introduces an unused index variable i, it still works correctly. Option D uses range(len(mylist)) to access each element by index and prints mylist[i].upper(). Option B fails because it does not print the result; it only reassigns the variable. Option C omits the parentheses on upper(), printing the method object instead of the string.
A list contains strings and numbers: items = ['apple', 10, 'banana', 20]. A programmer wants to create a new list that contains only the strings. Which approach is correct?
Explanation: The `isinstance(item, str)` function is the recommended way to check if an item is a string because it handles inheritance and is more readable. Option C, `type(item) == str`, also works in this case but is not considered the best practice for type checking in Python, especially when dealing with subclasses. Option A uses `isdigit()`, which only works for strings that represent digits, not all strings. Option B uses `type(item) is 'str'`, which compares the type to a string literal, which is incorrect.
A programmer needs to check if at least one element in a list of booleans flags is True. Which expression correctly does this?
Explanation: The built-in `any()` function returns `True` if at least one element in the iterable is truthy. For a list of booleans, this correctly checks if any element is `True`. Option A, `True in flags`, only checks for the exact boolean `True`, but if the list contained truthy non-boolean values (e.g., integers), it would not work. Since the question specifies a list of booleans, both work conceptually, but `any()` is the standard, more robust approach and is the intended correct answer here.
What is the output of the code?
Explanation: The code uses a for loop with range(5) to iterate over numbers 0 through 4. Inside the loop, an if statement checks if the current number equals 3; if true, the continue statement skips the remainder of the current iteration and moves to the next iteration. Therefore, when i is 3, the print(i) statement is skipped, but the loop continues with i=4, printing 4. Thus, the output is '0 1 2 4' (each on a new line). Option C correctly lists the printed values as 0, 1, 2, and 4.
+15 more Control Flow, Loops, Lists and Logic questions available
Practice all Control Flow, Loops, Lists and Logic questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Control Flow, Loops, Lists and Logic. 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
Control Flow, Loops, Lists and Logic 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. Control Flow, Loops, Lists and Logic is tested as part of the Certified Entry-Level Python Programmer PCEP blueprint. Practicing with targeted Control Flow, Loops, Lists and Logic 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 Control Flow, Loops, Lists and Logic 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 Control Flow, Loops, Lists and Logic practice session with instant scoring and detailed explanations.
Start Control Flow, Loops, Lists and Logic Practice →