hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    Why do we use negative slicing in Python strings?
    Question



    Why do we use negative slicing in Python strings?

    A.

    To reverse the string

    B.

    To extract elements from the end

    C.

    To add elements to a string

    D.

    To find the length of the string

    E.

    To replace characters in a string

    Correct option is B

    Negative slicing is used to extract elements from the end of a string.
    Important Key Points:
    1. Negative slicing in Python allows accessing string elements starting from the end of the string using negative indices.
    2. For example, "Python"[-1] returns 'n', the last character of the string.
    3. Using [::-1] as a slicing pattern reverses the string completely.
    Knowledge Booster:
    · Reversing a string is achieved using [::-1], but negative slicing itself doesn’t reverse the string.
    · Adding elements to a string is not possible, as strings in Python are immutable.
    · Finding the length of a string is done using the len() function, not slicing.
    · Replacing characters in a string is done using the replace() method.

    Free Tests

    Free
    Must Attempt

    RBI Asst Prelims 2026: Quant Advance level Test 01

    languageIcon English
    • pdpQsnIcon35 Questions
    • pdpsheetsIcon35 Marks
    • timerIcon20 Mins
    languageIcon English
    Free
    Must Attempt

    RBI Asst Prelims 2026: Reasoning Advance level Test 01

    languageIcon English
    • pdpQsnIcon35 Questions
    • pdpsheetsIcon35 Marks
    • timerIcon20 Mins
    languageIcon English
    Free
    Must Attempt

    NABARD Development Assistant Mains 2026 Full Mock Test -01

    languageIcon English
    • pdpQsnIcon150 Questions
    • pdpsheetsIcon150 Marks
    • timerIcon105 Mins
    languageIcon English
    test-prime-package

    Access ‘IBPS SO IT Officer’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    383k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow