All Coursera Quiz Answers

Automate Cybersecurity Tasks with Python Weekly challenge 1 Quiz Answers

In this article i am gone to share Coursera Course: Automate Cybersecurity Tasks with Python Weekly challenge 1 Quiz Answers with you..

Enroll Link: Automate Cybersecurity Tasks with Python


Also visit:ย  Automate Cybersecurity Tasks with Python Weekly challenge 4 Quiz Answers


 

Automate Cybersecurity Tasks with Python Weekly challenge 1 Quiz Answers

Question 1)
In a cybersecurity setting, which of these tasks would it be common to apply Python to? Select all that apply.

  • Manually checking individual timestamps in a log
  • Reducing the effort needed to manage an access control list
  • Automating how a log is read when responding to an incident
  • Automating several tasks from a playbook into one workstream

Question 2)
The purpose of the following code is to print an “Attempting connection” message while the value of the count variable is less than 10. The value of count should increase by 1 with each iteration of the loop. What is wrong with the code? Select all that apply.

count = 1
while count < 10:
print("Attempting connection")
count = count + 1
  • The line with print(“Attempting connection”) is not indented.
  • The line with count = count + 1 is not indented.
  • The line with count = 1 is not indented
  • The line with while count < 10: is not indented.

Question 3)
What data type requires quotation marks (” “)?

  • Integer
  • String
  • Boolean
  • Float

Question 4)
Which line of Python code would create a Boolean value of True?

  • print(10<100)
  • print(25<24)
  • print(“True”)
  • print([“Boolean”])

Question 5)
How do you assign the string value “rtp3426” to a variable called device_id?

  • device_id = “rtp3426”
  • device_id = rtp3426
  • device_id(“rtp3426”)
  • device_id(rtp3426)

Question 6)
What will this code do when you run it?

var2 = ["a","b","c"]
var2_type = type(var2)
print(var2_type)
  • Indicate that var2 contains list data
  • Output the characters “a”, “b”, and “c” to the screen
  • Print the string “var2_type” to the screen
  • Change the data type of var2

Question 7)
You want to check the string stored in an update_status variable. When it contains a value of “incomplete”, you want to print a “schedule update” message. Right now, this conditional statement is not correct. What are the problems with this conditional statement? Select all that apply.

if update_status != "incomplete"
print("schedule update")
  • The operator should not be !=. It should be ==.
  • The line with print(“schedule update”) should not be indented.
  • There should be quotation marks around the variable update_status.
  • A colon (:) is missing at the end of the conditional header.

Question 8)
Fill in the blank: An else statement _____.

  • executes when the condition in the if statement preceding it evaluates to True
  • is required after every if statement
  • contains its own unique condition
  • executes when the condition in the if statement preceding it evaluates to False

 

Question 9)
What iterative statement should you use if you want to print the numbers 1, 2, and 3?

for i in range(1,3):
print(i)

for i in [1, 2, 3]:
print(i)

for i in [1,3]:
print(i)

for i in range(0,3):
print(i)

 

Question 10)
How many times will the following code print the “warning” message?

count = 1
while count < 5:
print("warning")
count = count + 1
  • 5
  • 4
  • 0
  • 1

 

Question 11)
Fill in the blank: Automation is _____.

  • the use of technology to reduce human and manual effort to perform common and repetitive tasks
  • the combination of technology and manual effort to complete a task
  • the use of human and manual effort to reduce technological power consumption
  • the replacement of existing technology

Question 12)
Which line of code assigns the string “dtanaka” to a variable called username?

  • username = “dtanaka”
  • username(“dtanaka”)
  • username = dtanaka
  • “dtanaka” = username

Question 13)
Fill in the blank: If you ran the following code, the output would _____.

var1 = 9.5
var1_type = type(var1)
print(var1_type)
  • reassign var1 as float data
  • output 9.5 to the screen
  • reassign var1 as string data
  • indicate that var1 contains float data

Question 14)
What is the syntax problem in the following code?

if username == "aestrada":
print("username found")
  • Both lines are not indented.
  • The first line should be indented one space, and the second line should be indented two spaces.
  • The line with if username == “aestrada”: is not indented.
  • The line with print(“username found”) is not indented.

Question 15)
Which of these are string data? Select all that apply.

  • “100”
  • 100
  • [100, 200, 300]
  • “user1”

Question 16)
Which data type always has a value of either True or False?

  • Float
  • List
  • String
  • Boolean

Question 17)
What code can you use to return the data type of the value stored in the input variable?

  • type(“string”)
  • print(input)
  • print(“type”)
  • type(input)

 

Question 18)
You are checking whether the string stored in a device_id variable matches to the correct device ID, the string “15hgu3769”. When it matches, you want to print, “Login successful!”. Which conditional statement has the correct syntax needed to do this?

if device_id != “15hgu3769”
print(“Login successful!”)

if device_id == “15hgu3769”:
print(“Login successful!”)

if “device_id” = “15hgu3769”
print(“Login successful!”)

if “device_id == 15hgu3769”
print(“Login successful!”)

 

Question 19)
You have written the following code:

if operating_system == "OS 3":
print("Updates needed")

You want to add to it so that it will print a “No updates needed” message whenever the value of operating_system is not “OS 3”. Which lines of code have the correct syntax to do this?

else
print(“No updates needed”)

else operating_system != “OS 3”:
print(“No updates needed”)

elif operating_system == “OS 3”:
print(“No updates needed”)

else:
print(“No updates needed”)

 

Question 20)
What are the variables in the following code? Select all that apply.

username = “kcarter”
attempts = 5
print(username)
print(attempts)
print(“locked”)

  • “locked”
  • “kcarter”
  • username
  • attempts

 

Question 21)
You are implementing security measures on a server. If a user has more than 3 failed login attempts, the program should print “locked out”. The number of failed login attempts is stored in a variable called failed_attempts. Which conditional statement has the correct syntax needed to do this?

if failed_attempts <= 3:
print(“locked out”)

if failed_attempts < 3
print(“locked out”)

if failed_attempts >= 3
print(“locked out”)

if failed_attempts > 3:
print(“locked out”)

 

Question 22)
You wrote the following code:

if attempts >= 5:
print("locked")
else:
print("try again")

If the value in the attempts variable is 3, what will Python do?

  • Output the message “locked”
  • First output the message “locked” and then output the message “try again”
  • First output the message “try again” and then output the message “locked”
  • Output the message “try again”

 

Question 23)
What will this iterative statement do?

for i in [0, 5]:
print(i)
  • Output the integer 0
  • Output the integers 0 and 5
  • Output the integers 0, 1, 2, 3, and 4
  • Output the integers 0, 1, 2, 3, 4, and 5

Question 24)
Fill in the blank: If you use Python code to reduce the manual effort needed to manage an access control list, this is an example of _____.

  • data analysis
  • debugging
  • automation
  • reassignment

Question 25)
What is wrong with the following code?

for username in failed_login:
print(username)
  • The line with print(username) is not indented.
  • The line with for username in failed_login: is not indented.
  • Both lines are not indented.
  • The first line should be split in two, and in failed_login: should be indented on the new line.

Question 26)
Fill in the blank: String data _____.

  • must be placed in quotation marks
  • must include a decimal point
  • must be placed in parentheses
  • must be placed in brackets

Question 27)
What are possible values for the Boolean data type? Select all that apply.

  • False
  • True
  • >
  • !=

Question 28)
What iterative statement can you use if you want to print “Security alert” five times?

for i in range(5):
print(“Security alert”)

for i in range(6):
print(“Security alert”)

for i in range(1,5):
print(“Security alert”)

for i in [0, 5]:
print(“Security alert”)

Question 29)
If you want to run a loop that repeats if a count variable is less than 50, what code should your loop header contain?

  • while count < 50:
  • while count == 50:
  • print(50)
  • count = count + 50

Question 30)
You want to print all even numbers between 0 and 10 (in other words, 0, 2, 4, 6, 8, and 10). What should your next line of code be?

count = 0
while count <= 10:
print(count)
  • count = count + 1
  • if count < 10:
  • count = 1
  • count = count + 2