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

BEFORE VERSION CONTROL

QUESTION 1 OF 9

Your colleague sent you a patch called fix_names.patch, which fixes a config file called fix_names.conf. What command do you need to run to apply the patch to the config file? Nice job! The patch command with the file to be patched, followed by the filename of the patch, will apply it.

A
diff names.conf fix_names.conf
B
patch fix_names.conf names.conf
C
patch fix_names.conf < fix_names.patchCorrect Answer
D
diff names.conf_orig names.conf_fixed > fix_names.conf
QUESTION 2 OF 9

You're helping a friend with a bug in a script called fix_permissions.py, which fixes the permissions of a bunch of files. To work on the file, you make a copy and call it fix_permissions_modified.py. What command do you need to run after solving the bug to send the patch to your friend? Awesome! The diff command will allow us to compare and apply the differences between the files.

A
diff fix_permissions.py fix_permissions_modified.py > fix_permissions.patchCorrect Answer
B
patch fix_permissions.py < fix_permissions_modified.py
C
patch fix_permissions.py > fix_permissions.patch
D
diff fix_permissions.py fix_permissions.diff
QUESTION 3 OF 9

The _____ commandhighlights the words that changed in a file instead of working line by line. Right on! The wdiff command highlights the words that changed in a file by color, in addition to working line by line.

A
diff
B
diff -u
C
wdiffCorrect Answer
D
patch
QUESTION 4 OF 9

How can we choose the return value our script returns when it finishes? Great work! A script can use sys.exit to finish processing and return the number passed as an argument as the script's return code.

A
Using the exit command from the sys moduleCorrect Answer
B
Use the patch command
C
Use the diff command
D
Use meld
QUESTION 5 OF 9

In addition to the original files, what else do we need before we can use the patch command? Woohoo! We need to use the patch command with the diff file to apply new changes to the original file.

A
Diff fileCorrect Answer
B
exit command of the sys module
C
Version control
D
Full copy of the new files
QUESTION 6 OF 9

What’s the goal of a version control system? Right on! A version control system allows us to keep track of when and who did what changes to our files. Those can be code, configuration, images, or whatever else we need to track.

A
To make sure that our code has no bugs
B
To keep track of changes made to our filesCorrect Answer
C
To have backup copies of our code
D
To store code, images, configuration, and videos
QUESTION 7 OF 9

What’s the goal of the diff tool? You got it! The diff tool shows all the differences between any type of file. By highlighting what’s changed, it helps us understand the changes and see how the files have been modified.

A
To keep track of changes to our files
B
To check if our changes make sense
C
To highlight new lines in Python files
D
To show the differences between two filesCorrect Answer
QUESTION 8 OF 9

What does the patch command do? Right on! While diff is the command that generates the difference between two files, patch is the command that applies those differences to the original file.

A
It generates a file with the differences between two files.
B
It shows the changes made in a directory of files.
C
It redirects the contents of a file into standard input.
D
It applies the changes contained in a diff file to another file.Correct Answer
QUESTION 9 OF 9

We've prepared a diff file with the changes that need to be applied to the script. What does our colleague need to do now? You nailed it! To automatically apply changes to a file, we need to run the patch command on the file that we want to modify with the diff file as input.

A
Look at the changes in the diff file and manually modify the original file with those same changes.
B
Run diff disk_usage.diff disk_usage.py.
C
Ask us to send them the full file, not just the diff file.
D
Run patch disk_usage.py < disk_usage.diff.Correct Answer

Ready to test your recall?

Your colleague sent you a patch called fix_names.patch, which fixes a config file called fix_names.conf. What command do you need to run to apply the patch to the config file? Nice job! The patch command with the file to be patched, followed by the filename of the patch, will apply it.

A
diff names.conf fix_names.conf
B
patch fix_names.conf names.conf
C
patch fix_names.conf < fix_names.patch
D
diff names.conf_orig names.conf_fixed > fix_names.conf

How confident are you in this answer?