0
0
Prompt Engineering / GenAIml~20 mins

PII detection and redaction in Prompt Engineering / GenAI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PII Protection Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary goal of PII detection in text data?
Imagine you have a document containing names, phone numbers, and addresses. What is the main purpose of PII detection in this context?
ATo increase the document's length by adding more details
BTo identify and locate personal information so it can be protected or removed
CTo translate the document into another language
DTo summarize the document's main ideas
Attempts:
2 left
💡 Hint
Think about privacy and data protection.
Predict Output
intermediate
2:00remaining
What is the output of this PII redaction code snippet?
Given the following Python code that replaces email addresses with '[REDACTED]', what will be printed?
Prompt Engineering / GenAI
import re
text = 'Contact me at alice@example.com or bob@example.org.'
redacted = re.sub(r'\b[\w.-]+@[\w.-]+\.\w+\b', '[REDACTED]', text)
print(redacted)
AContact me at alice@example.com or [REDACTED].
BContact me at alice@example.com or bob@example.org.
CContact me at [REDACTED] or bob@example.org.
DContact me at [REDACTED] or [REDACTED].
Attempts:
2 left
💡 Hint
Look at the regular expression and what it matches.
Model Choice
advanced
2:00remaining
Which model type is best suited for detecting PII in unstructured text?
You want to build a system that finds names, phone numbers, and addresses in messy text data. Which model type is most appropriate?
ANamed Entity Recognition (NER) model trained on labeled PII data
BImage classification model trained on photos
CClustering model grouping similar documents
DRegression model predicting numerical values
Attempts:
2 left
💡 Hint
Think about models that find specific words or phrases in text.
Metrics
advanced
1:30remaining
Which metric best measures the accuracy of a PII detection model?
You have a PII detection model. Which metric tells you how many PII items it correctly finds without too many mistakes?
AF1 score, balancing precision and recall
BMean squared error
CAccuracy on image pixels
DSilhouette score
Attempts:
2 left
💡 Hint
Consider metrics that handle imbalanced classes and both false positives and false negatives.
🔧 Debug
expert
2:30remaining
Why does this PII redaction code fail to redact phone numbers?
Review the code below. It redacts emails but fails to redact phone numbers. What is the main reason?
Prompt Engineering / GenAI
import re
text = 'Call me at 123-456-7890 or email me at jane@domain.com.'
redacted = re.sub(r'\b[\w.-]+@[\w.-]+\.\w+\b', '[REDACTED]', text)
print(redacted)
AThe text variable is empty
BThe code has a syntax error in the regex pattern
CThe regex only matches email addresses, not phone numbers
DThe print statement is missing parentheses
Attempts:
2 left
💡 Hint
Look at what the regex pattern is designed to find.