Bird
0
0

Consider this code snippet representing a data request under GDPR:

medium📝 Analysis Q13 of 15
Cybersecurity - Compliance and Governance
Consider this code snippet representing a data request under GDPR:
request = {"user_id": 123, "consent": True, "data": "email"}
if request["consent"]:
    print("Data can be processed")
else:
    print("Consent required")

What will be the output?
AConsent required
BData can be processed
CError: KeyError
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Check the consent value in the request

    The key "consent" has the value True, meaning consent is given.
  2. Step 2: Follow the if condition logic

    Since consent is True, the code prints "Data can be processed".
  3. Final Answer:

    Data can be processed -> Option B
  4. Quick Check:

    Consent True means process data [OK]
Quick Trick: True consent prints 'Data can be processed' [OK]
Common Mistakes:
MISTAKES
  • Assuming consent is False by default
  • Expecting a KeyError due to missing keys
  • Thinking no output occurs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cybersecurity Quizzes