Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to show what monitoring tools check first.
Cybersecurity
if system_logs.[1]('error') != -1: alert_admin()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that do not exist on strings like 'search' or 'contains'
Using 'index' which raises an exception if not found
✗ Incorrect
The find method returns -1 if the pattern is not found, which helps detect threats early.
2fill in blank
mediumComplete the code to trigger an alert when CPU usage is high.
Cybersecurity
if cpu_usage [1] 80: send_alert('High CPU usage')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than operator
Using equality operator instead of comparison
✗ Incorrect
The operator > checks if CPU usage is greater than 80%, which indicates a potential threat or overload.
3fill in blank
hardFix the error in the code that checks for unusual login attempts.
Cybersecurity
if login_attempts.get('user123', 0) [1] 5: lock_account('user123')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using => which is invalid in Python
Using == which checks equality only
✗ Incorrect
The correct operator is >= to check if login attempts are 5 or more.
4fill in blank
hardFill both blanks to filter logs for failed login attempts over 3 times.
Cybersecurity
suspicious_users = {user: count for user, count in login_failures.items() if count [1] [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using equality instead of greater than
Using less than which filters wrong users
✗ Incorrect
The code filters users with failed login counts greater than 3.
5fill in blank
hardFill both blanks to create a dictionary of IPs with requests over 100.
Cybersecurity
high_traffic_ips = { ip: count for ip, count in requests.items() if count {BLANK_2}} {{BLANK_2}} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets which create lists
Using less than operator
Missing the opening brace
✗ Incorrect
The dictionary comprehension starts with {, filters counts greater than 100.