nerdexam
CompTIA

CAS-005 · Question #72

A security administrator needs to automate alerting. The server generates structured log files that need to be parsed to determine whether an alarm has been triggered. Given the following code…

The correct answer is D. <"error_log": {"system_1": {"InAlarmState": True }}}. Based on the provided Python code snippet, the answer <"error_log": {"system_1": {"InAlarmState": True }} is a minimal example of the JSON data structure that would cause the code's if condition to evaluate as True. The code checks for the presence and value of a nested key: if…

Submitted by tarun92· Mar 6, 2026Security Engineering

Question

A security administrator needs to automate alerting. The server generates structured log files that need to be parsed to determine whether an alarm has been triggered. Given the following code function:

Which of the following is most likely the log input that the code will parse? A.

Exhibits

CAS-005 question #72 exhibit 1
CAS-005 question #72 exhibit 2

Options

  • B<"error_log"><"system_1"></"InAlarmstate"="True"></"system_1"></"error_l
  • D<"error_log": {"system_1": {"InAlarmState": True }}}

How the community answered

(27 responses)
  • B
    11% (3)
  • D
    89% (24)

Explanation

Based on the provided Python code snippet, the answer <"error_log": {"system_1": {"InAlarmState": True }} is a minimal example of the JSON data structure that would cause the code's if condition to evaluate as True. The code checks for the presence and value of a nested key: if parsed_log["error_log"]["system_1"]["InAlarmState"]: print("System 1 is in an alarm state!")

Community Discussion

No community discussion yet for this question.

Full CAS-005 Practice