Courseiva

PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions

Which of the following correctly creates a tuple with a single element 5?

⚠ Common exam trap

The trap here is that candidates mistakenly believe parentheses alone create a tuple, overlooking the mandatory trailing comma for single-element tuples, which Cisco tests to distinguish between tuple creation and simple expression grouping.

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

✓

t = (5,)

In Python, a tuple with a single element requires a trailing comma after the element. Without the comma, parentheses are treated as grouping operators for expression evaluation, not as a tuple literal. Thus, `t = (5,)` creates a tuple containing the integer 5.

Answer analysis

Option-by-option breakdown

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

  • ✓

    t = (5,)

    Why this is correct

    Correct. The trailing comma is required to create a single-element tuple.

  • ✗

    t = (5)

    Why it's wrong here

    Incorrect. Without a trailing comma, `(5)` is just the integer 5, not a tuple.

  • ✗

    t = (5)

    Why it's wrong here

    Incorrect. Same as B; `(5)` evaluates to the integer 5.

  • ✗

    t = (5, 5)

    Why it's wrong here

    Incorrect. `(5, 5)` creates a tuple with two elements, not one.

About these practice questions

One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.