All Coursera Quiz Answers

Test your knowledge: Debug Python code Quiz Answer

In this article i am gone to share Coursera Course: Automate Cybersecurity Tasks with Python Week 4 Practice Quiz | Test your knowledge: Debug Python code Quiz Answer with you..

Enroll Link:  Automate Cybersecurity Tasks with Python

About this Course: In this course, you will be introduced to the Python programming language and apply it in a cybersecurity setting to automate tasks. You’ll start by focusing on foundational Python programming concepts, including data types, variables, conditional statements, and iterative statements. You’ll also learn to work with Python effectively by developing functions, using libraries and modules, and making your code readable. In addition, you’ll work with string and list data, and learn how to import, parse and debug files. Google employees who currently work in cybersecurity will guide you through videos, provide hands-on activities and examples that simulate common cybersecurity tasks, and help you build your skills to prepare for jobs.


Also visit:  Test your knowledge: Work with files in Python Quiz Answer


 

Test your knowledge: Debug Python code Quiz Answer

Question 1)
What types of errors might you encounter while debugging code? Select three answers.
  • Syntax errors
  • Iteratives
  • Logic errors
  • Exceptions
Question 2)
The purpose of this code is to indicate whether a particular operating system needs to be updated. However, it contains a syntax error. Run this code, analyze its output, and then debug it. (If you want to undo your changes to the code, you can click the Reset button.)
operating_system = "OS 2"
if operating_system == "OS 1":    
print("updates needed")
elsif operating_system == "OS 2":    
print("no updates needed")
Based on what you discover, how can you fix the error?
  • Indent the elsif statement.
  • Use single equals signs (=) and not double equals signs (==).
  • Change the keyword elsif to elif.
  • Remove all colons (:).
Question 3)
You have written code that assigns security incident tickets to the appropriate cybersecurity team based on its priority level. If the priority level is 1, it should get forwarded to Team A. If the priority level is 2, it should get forwarded to Team B. When testing your code, you notice that an incident with priority level 2 is forwarded to Team A instead of Team B. What type of error is this?
  • Name error
  • Logic error
  • Exception
  • Syntax error
Question 4)
You have written code that uses a search algorithm to find an employee’s IP address. When testing your code, an error message indicates that an unknown index is being accessed. What type of error is this?
  • Exception
  • Logic error
  • Syntax error
  • Iterative