Python Institute PCES sample questions with explanations for secure scripting, secrets, files, hashing, authorization, and logs.
These original sample questions are designed to help you check how PCES topics appear in decision-style prompts. They are not taken from the live exam.
Use these sample questions as a guided self-assessment for PCES-30-0x: Certified Entry-Level Security Specialist with Python topics such as Python foundations, secure coding, input validation, secrets, file handling, authentication, authorization, hashing, encryption, monitoring, and evidence. The prompts focus on safe implementation choices.
The sample set below is part of the Python Institute PCES guide path:
Work through each prompt before opening the explanation. PCES questions reward reduced trust, narrow permission, safe failure, and evidence that does not expose sensitive data.
Topic: Path traversal
A Python script receives a filename from a user and opens reports/ plus that filename. The script must only read approved report files from the reports directory. Which change is strongest?
reports/.access denied for all failures.Best answer: B
Explanation: User-controlled file paths can escape an intended directory through traversal patterns or absolute paths. The stronger answer constrains the final resolved path and limits what files are acceptable before opening anything.
Why the other choices are weaker:
What this tests: Path safety, input validation, allowlists, and least privilege.
Related topics: File handling; Path traversal; Input validation; Least privilege
Topic: Secrets and logs
A beginner script uses an API token. During debugging, the developer prints the full token when a request fails. What is the safest correction?
secret so readers know it is sensitive.Best answer: B
Explanation: Secrets should not be committed, printed, or exposed in routine logs. A safer script reads secrets from an approved runtime source and records useful failure context without revealing the credential.
Why the other choices are weaker:
What this tests: Secret handling, redaction, configuration, and log hygiene.
Related topics: Secrets; Environment variables; Logging; Redaction
Topic: Hashing vs encryption
A script needs to verify that a downloaded file was not changed during transfer. The script does not need to recover hidden content from the digest. Which technique best fits?
Best answer: A
Explanation: A hash digest is appropriate for integrity verification when compared to a trusted expected value. Encryption protects confidentiality, while encoding and renaming do not prove the file is unchanged.
Why the other choices are weaker:
What this tests: Hashing, integrity, encryption distinction, and evidence.
Related topics: Hashing; Encryption; Integrity; File verification
Topic: Authentication vs authorization
A user successfully logs in to an internal tool. The tool then lets the user download every department’s security report. What control is missing?
Best answer: B
Explanation: Authentication proves identity. Authorization decides what that identity may do. A login alone does not grant access to every resource.
Why the other choices are weaker:
What this tests: Identity, authorization, access control, and least privilege.
Related topics: Authentication; Authorization; Access control; Least privilege
Tech Exam Lexicon and IT Mastery are independent study tools. They are not affiliated with, endorsed by, or sponsored by Python Institute or any certification body.