🌍 All Study Guides📊 Dashboard📰 Blog💡 About
Google IT Automation with Python Professional Certificate • STUDY MODE

PRACTICE QUIZ

QUESTION 1 OF 28

What will the following command return? grep "ERROR Tried to add information to closed ticket" syslog.log

A
A duplicate file of syslog with the “Tried to add information to closed ticket” errors removed
B
All the closed tickets in syslog
C
All the ERROR logs in which the system tried to add information to closed ticketCorrect Answer
D
All the ERROR logs in syslog
QUESTION 2 OF 28

You can reverse the order of the sort using the reverse parameter. What type of argument does the reverse parameter take?

A
Operator
B
Sort
C
BooleanCorrect Answer
D
Values
QUESTION 3 OF 28

What is the primary advantage of using regular expressions when writing automation scripts to process a system log and generate reports from log files?

A
Flexible pattern matching for extracting specific data from log entriesCorrect Answer
B
Simplify the process of creating log files
C
Automate the installation of log analysis software
D
Enhance the visual presentation of log data in reports
QUESTION 4 OF 28

While you were working with the log file named syslog.log, what command did you use to view the file?

A
cat file syslog.log
B
grep syslog.log
C
cat syslog.logCorrect Answer
D
search syslog.log
QUESTION 5 OF 28

What would you expect the command grep "ERROR Ticket doesn't exist" syslog.log to return?

A
All ERROR logs in syslog.log with the error message “Ticket doesn't exist"Correct Answer
B
All ERROR logs in syslog.log
C
All logs in syslog.log except the ones with the error message “Ticket doesn't exist"
D
All logs in syslog.log that do not have an existing ticket
QUESTION 6 OF 28

What is the Python module used to perform similar tasks to the Unix command grep for filtering log data?

A
logfilter module
B
re (Regular Expression) moduleCorrect Answer
C
logsearch module
D
grep module
QUESTION 7 OF 28

Evaluate the following problem statement: “I want to create a script to sort files.” What's missing?

A
The problem statement does not specify what the script is supposed to do.
B
The problem statement does not specify the programming language.
C
The problem statement is complete.
D
The problem statement does not specify what files to sort.Correct Answer
QUESTION 8 OF 28

Which of the following commands would convert a csv file named error_message.csv into HTML file named errors.html?

A
/csv_to_html.py error_message.csv /var/www/html/<errors.html>.html
B
/csv_convert_html.py error_message.csv /var/www/html/<errors>.html
C
./csv_to_html.py error_message.csv /var/www/html/<errors>.htmlCorrect Answer
D
/html_to_csv.py error_message.csv /var/www/html/<errors>.html
QUESTION 9 OF 28

Once you've understood the problem statement, what should be the second step for your coding project? Right on! You'll want to figure out how to tackle the problem with tools such as the Python Standard Library.

A
Planning
B
Writing the code
C
Researching available toolsCorrect Answer
D
Writing a design document
QUESTION 10 OF 28

Which task can you accomplish by using regular expressions in log analysis?

A
Parsing log entries to extract specific fieldsCorrect Answer
B
Sorting log entries based on timestamps
C
Counting the total number of log entries in a file
D
Converting log data into graphical charts
QUESTION 11 OF 28

Complete the sentence for the following Python regular expression: To match a string stored in a line variable, we use the search() method by defining a_____.

A
span
B
line
C
patternCorrect Answer
D
log
QUESTION 12 OF 28

When sorting this dictionary: fruit = {"oranges": 3, "apples": 5, "bananas": 7, "peaches": 2} What will the following line of code return?

A
sorted(fruit.items(), key=operator.itemgetter(1))
B
[('apples', 5), ('bananas', 7), ('oranges', 3), (peaches, 2)]
C
sorted fruit = {"oranges": 3, "apples": 5, "bananas": 7, "peaches": 2}
D
[(peaches, 2), ('oranges', 3), ('apples', 5), ('bananas', 7)]Correct Answer
E
[('bananas', 7), ('apples', 5), ('oranges', 3), (peaches, 2)]
QUESTION 13 OF 28

Which of the following is a potential pitfall of automation in Python?

A
abilityIt increases the amount of manual work required
B
It makes the system more prone to errors
C
It improves the overall efficiency of the system
D
It limits the system's ability to adapt to changesCorrect Answer
QUESTION 14 OF 28

Why are regular expressions useful?

A
They allow us to search and manipulate text based on patternsCorrect Answer
B
They allow us to create graphical user interfaces
C
They allow us to perform mathematical operations
D
They allow us to connect to databases
QUESTION 15 OF 28

What is the method used to match a string stored in a line variable by defining a pattern?

A
re.search()Correct Answer
B
re.match()
C
re.find()
D
re.string()
QUESTION 16 OF 28

What is the primary purpose of using regular expressions in log analysis?

A
To encrypt log data for enhanced security
B
To compress log files and save storage space
C
To extract specific patterns and information from unstructured log dataCorrect Answer
D
To format log messages for easier readability
QUESTION 17 OF 28

Which of the following is true about using regular expressions?

A
They reduce the need of error checking in code
B
They don’t allow for flexible pattern matching in strings
C
They can simplify complex string processing tasksCorrect Answer
D
They can be used only in Python
QUESTION 18 OF 28

Why do you need to know how to write automation scripts that process a system log and generate reports from the log files?

A
To increase job complexity without adding tangible value to the organization
B
To eliminate the need for manual log analysis, saving time, and improving efficiencyCorrect Answer
C
To showcase proficiency in scripting languages without practical applications
D
To impress colleagues with technical skills and programming expertise
QUESTION 19 OF 28

What would you expect the command grep "ERROR" syslog.log to return?

A
All ERROR logs in syslog.logCorrect Answer
B
The ERROR messages in syslog.log
C
All logs in syslog.log
D
All ERROR logs in syslog.log that have no corresponding error message
QUESTION 20 OF 28

Which argument can be used with the sorted() function to sort a dictionary's items based on their values in descending order?

A
sorted(dictionary, reverse=True)
B
sorted(dictionary, key=lambda x: x[1], reverse=True)
C
sorted(dictionary.values(), reverse=True)
D
sorted(dictionary.items(), key=lambda x: x[1], reverse=True)Correct Answer
QUESTION 21 OF 28

If there is no csv file named user_emails.csv, what will the command nano user_emails.csv return?

A
A new csv file named user_emails.csvCorrect Answer
B
A new csv file named nano user_emails.csv
C
An error message
D
A new csv file named user_emails.csv populated withusers emails
QUESTION 22 OF 28

What will the following command return? grep "ERROR" syslog.log

A
A duplicate file of syslog with the errors removed
B
All the ERROR logs in syslogCorrect Answer
C
All the INFO logs in syslog
D
All the usernames in syslog
QUESTION 23 OF 28

When sorting this dictionary: fruit = {"oranges": 3, "apples": 5, "bananas": 4, "pears": 2} What will the following line of code return?

A
sorted(fruit.items(), key=operator.itemgetter(1))
B
[('bananas', 4), ('apples', 5), ('oranges', 3), ('pears', 2)]
C
sorted fruit = {"oranges": 3, "apples": 5, "bananas": 4, "pears": 2}
D
[('apples', 5), ('bananas', 4), ('oranges', 3), ('pears', 2)]
E
[('pears', 2), ('oranges', 3), ('bananas', 4), ('apples', 5)]Correct Answer
QUESTION 24 OF 28

When sorting this dictionary: fruit = {"oranges": 3, "apples": 5, "bananas": 7, "pears": 2} What will the following line of code return?

A
sorted(fruit.items(), key=operator.itemgetter(1))
B
[('bananas', 7), ('apples', 5), ('oranges', 3), ('pears', 2)]
C
[('pears', 2), ('oranges', 3), ('apples', 5), ('bananas', 7)]Correct Answer
D
[('apples', 5), ('bananas', 7), ('oranges', 3), ('pears', 2)]
E
sorted fruit = {"oranges": 3, "apples": 5, "bananas": 7, "pears": 2}
QUESTION 25 OF 28

What syntax would you use to enlist all the ERROR messages of a specific kind?

A
grep ERROR [file-name] [message]
B
grep [file-name] [message] ERROR
C
grep ERROR [message] [file-name]Correct Answer
D
grep [file-name] ERROR [message]
QUESTION 26 OF 28

In Python, regular expressions are typically handled using which module?

A
sys
B
math
C
reCorrect Answer
D
os
QUESTION 27 OF 28

How does the sorted() function sort items in a Python dictionary?

A
Sorts dictionary keys in descending order and returns a list of keys
B
Sorts dictionary keys in ascending order and returns a list of keysCorrect Answer
C
Sorts dictionary items based on their keys in ascending order and returns a list of items
D
Sorts dictionary items based on their values in ascending order and returns a list of items
QUESTION 28 OF 28

If there is no python script named ticky_check.py, what will the command nano ticky_check.py return?

A
A new python script named nano ticky_check.py
B
An error message
C
A new csv file named ticky_check.py
D
A new python script named ticky_check.pyCorrect Answer

Ready to test your recall?

What will the following command return? grep "ERROR Tried to add information to closed ticket" syslog.log

A
A duplicate file of syslog with the “Tried to add information to closed ticket” errors removed
B
All the closed tickets in syslog
C
All the ERROR logs in which the system tried to add information to closed ticket
D
All the ERROR logs in syslog

How confident are you in this answer?