Courseiva
Software Development and DesignmediumMultiple ChoiceObjective-mapped

200-901 Software Development and Design Practice Question

Which Python list comprehension correctly creates a list of squares for even numbers from 0 to 10?

⚠ Common exam trap

Cisco often tests the subtle difference between `range(10)` and `range(11)` to see if candidates remember that `range(n)` generates numbers from 0 to n-1, and also tests the distinction between `x % 2` (odd filter) and `x % 2 == 0` (even filter).

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

[x**2 for x in range(11) if x % 2 == 0]

It uses list comprehension syntax with `x**2` to square each number, iterates over `range(11)` to include numbers 0 through 10, and applies the condition `if x % 2 == 0` to filter only even numbers. This produces the list `[0, 4, 16, 36, 64, 100]` as required.

Answer analysis

Option-by-option breakdown

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

  • [x**2 for x in range(11) if x % 2 == 0]

    Why this is correct

    Correct: filters even numbers and squares them.

  • [x*2 for x in range(11) if x % 2 == 0]

    Why it's wrong here

    Multiplies by 2, not square.

  • [x**2 for x in range(10) if x % 2]

    Why it's wrong here

    if x % 2 catches odd numbers (non-zero), not even.

  • [x**2 for x in range(10) if x % 2 == 0]

    Why it's wrong here

    Missing 10 in range; range(10) goes 0-9.

About these practice questions

This 200-901 question is part of Courseiva's 989-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.