Courseiva
Strings →hardMultiple Choice

PCAP Strings Practice Question

Given the string 'Python', what is the result of 'Python'[::-1]?

⚠ Common exam trap

Python Institute often tests whether candidates understand that [::-1] reverses the sequence without altering case, so the trap is assuming the step of -1 also applies case transformations like lowercasing or uppercasing.

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

✓

'nohtyP'

The slice notation [::-1] creates a reversed copy of the string by using a step of -1, which traverses the sequence from the end to the beginning. Since strings in Python are immutable sequences of Unicode characters, this operation returns a new string with the characters in reverse order, preserving the original case of each character.

Answer analysis

Option-by-option breakdown

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

  • ✗

    'nohtyp'

    Why it's wrong here

    This is the result of reversing the lowercase string 'python' (i.e., 'python'[::-1]), but the intended original string is 'Python' with a capital leading 'P'. String slicing preserves the exact case of every character, so the leading 'P' must become the trailing character. Reversing 'Python' therefore yields 'nohtyP', not 'nohtyp'.

  • ✗

    'NOHYP'

    Why it's wrong here

    This option is not a reversed form of the intended string at all; it appears to combine an uppercased prefix and an erroneous truncation. Reversing 'Python' character-by-character simply reorders the characters to 'nohtyP' — no characters are dropped, added, or case-transformed. This answer might result from misapplying methods like `upper()` or `sorted()`, but it does not correspond to any standard reversal operation.

  • ✓

    'nohtyP'

    Why this is correct

    This is exactly the output of the slice `'Python'[::-1]`, which steps through the string from the last character to the first with a step of -1. Python's slicing mechanism creates a new string by copying the characters in reverse order while preserving each character's case and position relative to the others. Because the original string begins with an uppercase 'P', that 'P' appears at the final index, yielding 'nohtyP'.

  • ✗

    'Python'

    Why it's wrong here

    This option leaves the original string completely unchanged, which indicates that no reversal operation was actually performed. If the code used `'Python'[::-1]` or an equivalent like `''.join(reversed('Python'))`, the output would be the reversed string 'nohtyP'. Merely reading or printing the string without any slice step cannot reorder the characters, so this answer reflects a misunderstanding of the required operation.

About these practice questions

This PCAP question is part of Courseiva's 421-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 PCAP 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 PCAP exam.