Bird
0
0

Consider this code snippet used in dynamic malware analysis:

medium📝 Analysis Q13 of 15
Cybersecurity - Advanced Threat Protection
Consider this code snippet used in dynamic malware analysis:
log = []
for action in ['open_file', 'modify_registry', 'send_data']:
    log.append(f"Action: {action}")
print(log)

What will be the output?
A['open_file', 'modify_registry', 'send_data']
BAction: open_file Action: modify_registry Action: send_data
C['Action: open_file', 'Action: modify_registry', 'Action: send_data']
DError: log is not defined
Step-by-Step Solution
Solution:
  1. Step 1: Understand the loop and append operation

    The loop goes through each action and appends a string with 'Action: ' plus the action name to the list log.
  2. Step 2: Determine the final list content

    After the loop, log contains three strings: 'Action: open_file', 'Action: modify_registry', and 'Action: send_data'. Printing log shows this list.
  3. Final Answer:

    ['Action: open_file', 'Action: modify_registry', 'Action: send_data'] -> Option C
  4. Quick Check:

    Loop appends formatted strings = list with 'Action: ...' [OK]
Quick Trick: Look for string formatting inside loop append [OK]
Common Mistakes:
MISTAKES
  • Ignoring the 'Action: ' prefix in strings
  • Confusing list print with separate print lines
  • Assuming a runtime error without reason

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cybersecurity Quizzes