Courseiva

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

Exhibit

Refer to the exhibit.

```
>>> print(3 * 'abc')
```

Refer to the exhibit. What is the output of the Python code?

⚠ Common exam trap

Test-takers frequently confuse string multiplication with list multiplication or expect spaces between repetitions, but Python's string multiplication concatenates the string directly without any separator.

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

✓

abcabcabc

The code `print('abc' * 3)` uses the multiplication operator on a string. In Python, multiplying a string by an integer repeats the string that many times, concatenating the copies without any separator. Therefore, `'abc' * 3` produces the string `'abcabcabc'`, which is printed. The correct output is `abcabcabc` (without quotes).

Answer analysis

Option-by-option breakdown

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

  • ✗

    ['abc', 'abc', 'abc']

    Why it's wrong here

    Repeating a string with * produces concatenation, not a list, so the output is a single joined string rather than three separate list elements. The list form is tempting because repetition of a list does yield repeated elements, which is the correct result only when the operand is a list.

  • ✗

    abcabc abc

    Why it's wrong here

    String repetition concatenates without inserting spaces, so 'abc'*3 yields 'abcabcabc', not 'abcabc abc'. The spaced form is tempting because print with multiple comma-separated arguments inserts spaces, which is the correct output only when the code passes separate arguments rather than one repeated string.

  • ✗

    abc abc abc

    Why it's wrong here

    Repetition of a string concatenates directly, producing 'abcabcabc' with no separators, not space-separated tokens. The spaced form is tempting because join with a space delimiter yields 'abc abc abc', which is correct only when the code calls ' '.join on a sequence of three strings.

  • ✓

    abcabcabc

    Why this is correct

    String repetition with the `*` operator concatenates the original sequence three times, producing `abcabcabc`. This satisfies the stem's requirement to determine the exact output of the multiplication expression, since `"abc" * 3` yields the repeated string rather than raising an error or returning a numeric result.

About these practice questions

Courseiva writes every PCEP question from scratch — 482 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.