Practice Quiz: Advanced Bash Concepts

11. Which command does the while loop initiate a task(s) after?

  • done
  • while
  • n=1
  • do

12. Which line is correctly written to start a FOR loop with a sample.txt file?

  • do sample.txt for file
  • for file in sample.txt; do
  • for sample.txt in file; do
  • for sample.txt do in file

13. Which of the following Bash lines contains the condition of taking an action when n is less than or equal to 9?

  • while [ $n -le 9 ]; do
     
  • while [ $n -lt 9 ]; do
     
  • while [ $n -ge 9 ]; do
     
  • while [ $n -ot 9 ]; do

14. Which of the following statements are true regarding Bash and Python? [Check all that apply]

  • Complex scripts are better suited to Python.
  • Bash scripts work on all platforms.
  • Python can more easily operate on strings, lists, and dictionaries.
  • If a script requires testing, Python is preferable.

15. The _____ command lets us take only bits of each line using a field delimiter.

  • cut
  • echo
  • mv
  • sleep

Devendra Kumar

Project Management Apprentice at Google

Leave a Reply