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

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

What is the output of the following code? ```python

print('Hello', 'World', sep='-')

```

⚠ Common exam trap

Many candidates assume the default space separator is used or misread the hyphen as a space, leading them to choose 'Hello World' instead of recognizing the explicit `sep='-'` override.

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

Hello-World

The `print()` function's `sep` parameter specifies the separator between multiple arguments. By default, `sep` is a space, but here it is explicitly set to `'-'`, so the output joins 'Hello' and 'World' with a hyphen, producing 'Hello-World'. Option D is correct because the hyphen is placed directly between the two strings without any extra spaces.

Answer analysis

Option-by-option breakdown

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

  • HelloWorld

    Why it's wrong here

    Incorrect. No separator at all.

  • Hello - World

    Why it's wrong here

    Incorrect. No extra spaces around the separator.

  • Hello World

    Why it's wrong here

    Incorrect. This would be the default space separator.

  • Hello-World

    Why this is correct

    Correct. The dash separates the two words.

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.