{ "q1": { "type": "order", "question": "\n

\nSuppose you are about to start a new homework assignment and you wish to\nsync your local repository with the changes in GitHub, create a new\nhomework branch, and check which branch you are currently on.\n

\n\n

\nOrganize the git commands below in the proper order to accomplish\nthe tasks above.\n

\n", "responses": { "branch": "git branch", "checkout": "git checkout -b homework", "master": "git checkout master", "rebase": "git pull --rebase" } }, "q2": { "type": "order", "question": "\n

\nSuppose you create a new file in the homework branch and wish to record\nthis change, send it to GitHub, and then view the history of the\nrepository.\n

\n\n

\nOrganize the git commands below in the proper order to accomplish\nthe tasks above.\n

\n", "responses": { "add": "git add file", "commit": "git commit -m \"Add file\"", "push": "git push -u origin homework", "log": "git log" } }, "q3": { "type": "order", "question": "\n

\nOrder the following commands to match the descriptions below.\n

\n\n

\n

    \n\n
  1. View the inode information of a file.
  2. \n
  3. Create hard and soft links.
  4. \n
  5. Set permissions of a file.
  6. \n
  7. Recursively search directory for files by name and type.
  8. \n\n
\n

\n", "responses": { "stat": "stat", "ln": "ln", "chmod": "chmod", "find": "find" } }, "q4": { "type": "blank", "question": "\n

Suppose I had a process named bill with a PID of 1022\nthat was running crazy and taking up all the CPU. How would I do the\nfollowing:

\n\n

\n

    \n
  1. Send a keystroke that suspends the process? ____ (1)
  2. \n
  3. Send a keystroke that interrupts the process? ____ (2)
  4. \n
  5. Gracefully terminate the process using its PID? ____ (3)
  6. \n
  7. Forcefully terminate the process using its name? ____ (4)
  8. \n
\n

\n" }, "q5": { "type": "multiple", "question": "\n

What does the following pipeline do (select all that apply)?

\n\n
\ndu -h /etc/* 2> /dev/null | sort -rh > results.txt\n
\n", "responses": { "du_stdin": "Redirect the stdin of du into the stdout of sort", "du_stdout": "Redirect the stdout of du into the stdin of sort", "du_stderr": "Redirect the stderr of du into the stdin of sort", "du_null": "Redirect the stderr of du into /dev/null", "null_sort": "Redirect the contents of /dev/null into the stdin of sort", "sort_stdin": "Redirect the stdin of sort into results.txt", "sort_stdout": "Redirect the stdout of sort into results.txt", "sort_stderr": "Redirect the stderr of sort into results.txt" } }, "q6": { "type": "blank", "question": "\n

You are worried about the upcoming exam, so you decide to try to hack\nthe instructor's computer. You would start by using the ____ (1, just the\nname) program to scan his workstation (ie. xavier.h4x0r.space) for\nopen ports.

\n\n

Suppose the scan revealed an open port on 9213. You would make\na HTTP request to that location by running ____ (2, full\ncommand).

\n\n

You are on dodgy WIFI (ie. eduroam) and notice the connection\nis shaky. You would run ____ (3, full command), to check the\nlatency between your machine and the instructor's workstation.

\n" }, "q7": { "type": "blank", "question": "\n

Given the following script, which checks each file passed via command\nline arguments and reports if the file is readable:

\n\n

\nfor $file in '$@'; do                           # (1) ____\n    [-r \"$file\"] | echo file is readable!       # (2) ____\ndone\n
\n\n

Re-write the script so that it behaves properly.

\n" }, "q8": { "type": "blank", "question": "\n

Given the following script, which checks each file passed via command\nline arguments and reports if the file is readable:

\n\n

\nis_readable() {\n    test -r \"$@\"                                # (1) ____\n}\n\nwhile (-z \"$#\"); do                             # (2) ____\n    is_readable(\"$@\") | echo $@ is readable!    # (3) ____\n                                                # (4) ____\ndone\n
\n\n

Re-write the script so that it behaves properly.

\n" } }