PCAP Strings Practice Question
Exhibit
Configuration snippet:
import json
policy_string = '{"allow": true, "rate": 100}'
parsed = json.loads(policy_string)
print(parsed['rate'])Refer to the exhibit. What is the output?
⚠ Common exam trap
A common mix-up: candidates confuse the string literal representation (with quotes) with the printed output, mistakenly thinking that `print('100')` will display the quotes as part of the output.
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
✓
100
The code `print('100')` outputs the string `100` without quotes. In Python, `print()` displays the value passed to it; when a string literal is passed, it prints the characters of the string, not the surrounding quotes. Therefore, the output is `100` (the integer-like string, but as a string). Option B is correct because it shows the numeric value without quotes, which is how Python's `print()` renders a string.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
'100'
Why it's wrong here
The print() function writes the string's actual contents to standard output, without adding any quotation marks. The quotes in the source code are delimiters that define the string literal, but they are not part of the string value itself. To display quotes, one would need to include them explicitly or use repr(), so showing '100' with quotes is not what print('100') produces.
- ✓
100
Why this is correct
Official answer: print('100') displays the sequence of characters 1, 0, 0 on the console. The print() function strips the syntactic quotes and outputs the raw string content, so the visible result is 100 without surrounding quotation marks. This is the standard behavior of print() in Python 3.
- ✗
True
Why it's wrong here
Although '100' is a non-empty string and would be considered truthy in a boolean context like an if condition, print('100') does not evaluate its argument as a boolean. The print() function simply converts the argument to its string representation and writes it out. The output is the literal characters 1, 0, and 0, not the keyword True.
- ✗
Error
Why it's wrong here
The code print('100') is perfectly valid; it uses the built-in print() function with a string literal argument. No syntax or runtime error occurs because the parentheses and quotes are balanced and the string is well-formed. The program will execute and output the characters 100 to the console.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCAP question from scratch — 169 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 →
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.