Test your knowledge: Work with lists and develop algorithms Quiz Answer
In this article i am gone to share Coursera Course: Automate Cybersecurity Tasks with Python Week 3 Practice Quiz | Test your knowledge: Work with lists and develop algorithms 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 strings Quiz Answer
Test your knowledge: Work with lists and develop algorithms Quiz Answer
Question 1)
Review the following code:
my_list = ["a", "b", "c", "d"] my_list[2] = 4 print(my_list)
What will it display?
- [“a”, “b”, “4”, “d”]
- An error message
- [“a”, 4, “c”, “d”]
- [“a”, “b”, 4, “d”]
Question 2)
You are working with the list [“cwvQSQ”,”QvPvX5″,”ISyT3a”,”S7vgN0″]. Its elements represent machine IDs, and the list is stored in a variable named machine_ids. Which line of code will add the ID of “yihhLL” at index 3?
- machine_ids.insert(“yihhLL”,3)
- machine_ids.append(“yihhLL”,3)
- machine_ids.insert(3,”yihhLL”)
- machine_ids.append(“yihhLL”)
Question 3)
Which line of code will remove the username “tshah” from the following list?
access_list = [“elarson”, “bmoreno”, “tshah”, “sgilmore”]
- access_list.remove(2)
- access_list.remove(3)
- access_list.remove(“tshah”)
- access_list[“tshah”].remove()
Question 4)
As a security analyst, you are responsible for developing an algorithm that automates removing usernames that match specific criteria from an access list. What Python components would help you implement this? Select three answers.
- An if statement that compares a username to the criteria for removal
- The .remove() method
- The .append() method
- A for loop that iterates through the usernames in the access list