Courseiva
Question 175 of 498
Computer Programming and Python FundamentalseasyMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

A junior developer is writing a script to read a number from input and double it. They write:

num = input("Enter a number: ") result = num * 2

print(result)

When they test with input 5, the output is '55' instead of 10. What is wrong?

⚠ Common exam trap

Candidates often assume `input()` returns a number because the user typed digits, but Python treats all keyboard input as a string, and the `*` operator's string repetition behavior is a classic PCEP trick.

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

The input is treated as a string; they need to convert it to int.

The `input()` function in Python always returns a string, even if the user types a number. When you use the `*` operator on a string, it repeats the string, so `'5' * 2` yields `'55'`. To perform numeric multiplication, you must convert the input to an integer using `int(input(...))`.

Answer analysis

Option-by-option breakdown

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

  • There is a syntax error in the multiplication line.

    Why it's wrong here

    The syntax is valid, but produces unexpected results.

  • The print function is incorrectly formatting the output.

    Why it's wrong here

    print outputs the exact value of result.

  • The variable name 'num' conflicts with a built-in function.

    Why it's wrong here

    No built-in named 'num' is in scope.

  • The input is treated as a string; they need to convert it to int.

    Why this is correct

    input() returns a string; string * 2 duplicates the string.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.