Test your knowledge: Conditional and iterative statements Quiz Answer
In this article i am gone to share Coursera Course: Automate Cybersecurity Tasks with Python Week 1 Practice Quiz | Test your knowledge: Conditional and iterative statements 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.
Also visit: Test your knowledge: Core Python components Quiz Answer
Test your knowledge: Conditional and iterative statements Quiz Answer
Question 1)
What will the following code display?
ip_address = "192.168.183.51" if ip_address == "192.168.183.51": print("You're logged in.") else: print("Login failed, try again.")
- Both “You’re logged in.” and “Login failed, try again.”
- “Login failed, try again.”
- “You’re logged in.”
- Nothing
Question 2)
Which conditional statement prints the message “account locked” when the value of failed_logins is 3 or higher?
if failed_login_count > 3:
print(“account locked”)
if failed_login_count != 3:
print(“account locked”)
if failed_login_count == 3:
print(“account locked”)
- if failed_logins >= 3:
print(“account locked”)
Question 3)
Which code prints all numbers from 3 to 7?
for i in range(3, 7):
print(i)
for i in range(8):
print(i)
- for i in range(3, 8):
print(i)
for i in range(3, 4, 5, 6, 7):
print(i)
Question 4)
How many times does the following code print the “security alert” message?
count = 0 while count < 10: print("security alert") count = count + 1
- 9
- 5
- 0
- 10