Courseiva
Computer Programming and Python FundamentalsmediumMultiple SelectObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Which TWO of the following statements about Python's for loop are correct? (Choose Two)

⚠ Common exam trap

The PCEP exam often tests the misconception that a `for` loop always executes at least once, but in reality it can iterate zero times over an empty sequence, and they also test the less-known fact that `for` loops support an `else` clause.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

It can iterate over any sequence

A `for` loop in Python is designed to iterate over any iterable sequence, such as lists, tuples, strings, dictionaries, or ranges. This is a fundamental property of the `for` loop, which retrieves each item from the sequence in order until the sequence is exhausted.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • It can be used with a while loop condition

    Why it's wrong here

    Incorrect; for and while are separate constructs.

  • It can iterate over any sequence

    Why this is correct

    For works with lists, tuples, strings, etc.

  • It always executes at least once

    Why it's wrong here

    If the sequence is empty, the loop body does not execute.

  • It can be used with an else clause

    Why this is correct

    Yes, the else block runs after normal loop completion.

  • It is the only loop in Python

    Why it's wrong here

    Python also has while loops.

About these practice questions

Courseiva writes every PCEP question from scratch — 498 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.