QuiztudyPREMIUM
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.confB
patch fix_names.conf names.confC
patch fix_names.conf < fix_names.patchCorrect AnswerD
diff names.conf_orig names.conf_fixed > fix_names.confQUESTION 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 AnswerB
patch fix_permissions.py < fix_permissions_modified.pyC
patch fix_permissions.py > fix_permissions.patchD
diff fix_permissions.py fix_permissions.diffQUESTION 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
diffB
diff -uC
wdiffCorrect AnswerD
patchQUESTION 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 AnswerB
Use the patch commandC
Use the diff commandD
Use meldQUESTION 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 AnswerB
exit command of the sys moduleC
Version controlD
Full copy of the new filesQUESTION 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 bugsB
To keep track of changes made to our filesCorrect AnswerC
To have backup copies of our codeD
To store code, images, configuration, and videosQUESTION 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 filesB
To check if our changes make senseC
To highlight new lines in Python filesD
To show the differences between two filesCorrect AnswerQUESTION 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 AnswerQUESTION 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 AnswerReady 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?