PCEP Computer Programming and Python Fundamentals Practice Question
Exhibit
Refer to the exhibit.
{
"name": "config",
"version": 2,
"settings": {
"debug": true,
"port": 8080
}
}The exhibit shows a JSON configuration. Which Python data structure is best suited to represent this configuration?
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
✓
Dictionary
JSON objects map directly to Python dictionaries. Option B (Tuple) is wrong because tuples are immutable and lack key-value mapping. Option C (String) is wrong because a string would lose all structure, making access by key impossible. Option D (List) is wrong because lists are ordered sequences accessed by index, not by key-value pairs.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Dictionary
Why this is correct
A dictionary maps JSON objects directly: keys become strings and values become nested dictionaries, lists or scalars. This mirrors the exhibit's key-value pairs, satisfying the requirement to represent the configuration faithfully while allowing lookup by key rather than by positional index.
- ✗
Tuple
Why it's wrong here
A tuple is immutable, so it cannot represent a configuration whose keys and values may need updating. It tempts because tuples hold heterogeneous, ordered items and suit fixed records, but JSON objects map to mutable dictionaries with named keys, which tuples cannot express.
- ✗
String
Why it's wrong here
A string stores raw text and offers no key-based lookup, so nested configuration values cannot be accessed directly. It tempts because JSON is transmitted as text, but parsing converts it into a dictionary; keeping it as a string defeats the purpose of representing structured data.
- ✗
List
Why it's wrong here
A list is an ordered sequence indexed by position, so it cannot map configuration keys to values. It tempts because lists hold nested structures and preserve order, but JSON objects are unordered key-value mappings, which Python represents with a dictionary rather than a list.
Go deeper
Related to this question
About these practice questions
One of 482 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 →
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.