Courseiva
Computer Programming and Python FundamentalshardMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Exhibit

Refer to the exhibit.
{
  "name": "Alice",
  "age": 30,
  "city": "New York",
  "languages": ["Python", "Java"]
}
--- End of exhibit ---

The above JSON is loaded into a Python dictionary named data using json.load(). A developer writes:

print(data['languages'][1][:3])

What is printed?

⚠ Common exam trap

The PCEP exam often tests the combination of list indexing and string slicing, where candidates may forget that slicing returns a substring of the specified length, not the full string, or may misidentify the zero-based index of the list element.

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

Jav

The JSON data is loaded into a Python dictionary. The key 'languages' maps to a list of strings. Indexing with [1] retrieves the second element, which is 'Java'. Then slicing with [:3] extracts the first three characters, resulting in 'Jav'. Therefore, option B is correct.

Answer analysis

Option-by-option breakdown

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

  • IndexError

    Why it's wrong here

    Index 1 is valid.

  • Jav

    Why this is correct

    Index 1 'Java', first 3 chars.

  • Java

    Why it's wrong here

    Slice [:3] gives only 3 chars.

  • Pyt

    Why it's wrong here

    Index 0 is 'Python'.

About these practice questions

One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.