Courseiva
Data Types, Variables, Basic I/O and OperatorseasyMultiple ChoiceObjective-mapped

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

    List, not string.

  • abcabc abc

    Why it's wrong here

    Does not include space.

  • abc abc abc

    Why it's wrong here

    Spaces are not inserted.

  • abcabcabc

    Why this is correct

    Correct: repeats string 3 times.

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.