CS211 Shell Programming

Review for Second Quiz

  1. The grep command searches...
    1.  streams for uninherited objects
    2.  compiled programs for commands
    3.  text files for patterns
    4.  catacombs for the lost ark

  2. Which pattern would find all/only files with the extension .bak?
    1.  *[bak]
    2.  ?bak
    3.  *.bak
    4.  ?.bak

  3. Which operator means to look for a pattern at the start of a line?
    1.  period
    2.  asterisk
    3.  caret
    4.  dollar sign

  4. A closure is a minimum and/or maximum
    1.  number of characters in a file
    2.  number of characters in a pattern
    3.  number of repetitions of a pattern
    4.  number of times to think about an error

  5. The grep and wc commands can report the number of times a word appears in a file...
    1.  if we do at least two searches
    2.  if we search carefully once
    3.  if it appears more than once per line
    4.  if we are incredibly lucky

  6. Which UNIX calculator uses standard algebraic entry notation?
    1.  ac
    2.  bc
    3.  cc
    4.  dc

  7. What are three environment variables and what do they hold?
    1. ________________________________________________
    2. ________________________________________________
    3. ________________________________________________

  8. Which calendar command would show July of 1997?
    1.  cal 7
    2.  cal 7 97
    3.  cal 7 1997
    4.  cal [35612-35642]

  9. What is an exported variable?
    1.  one that is passed to a program
    2.  one that is passed to a second shell
    3.  all variables are exported
    4.  variables cannot be exported

  10. Where does control go when a subshell finishes running?
    1.  to the locker room for a shower
    2.  to its reward, but only if it was very good
    3.  nowhere: the script ends
    4.  back to the shell or command that called the subshell

  11. File descriptors are
    1.  numbers that stand for file streams
    2.  names of files in a directory
    3.  the permissions lists for files
    4.  fully qualified path statements for files

  12. If you want to write a simple, two-line file, you might use:
    1.  cat filename
    2.  cat > filename
    3.  echo filename
    4.  cat << filename

  13. If the cat command is not given an input filename, it assumes
    1.  you made a mistake and prints an error message
    2.  you are silly and beeps at you
    3.  you will continue input from stdin
    4.  that this is a good time to re-boot

  14. The tee command is useful for
    1.  covering up at the beach
    2.  sending output to the screen
    3.  sending output two places at once
    4.  preventing screen output from reaching the screen

  15. When creating and using an archive file, which is more important?
    1.  the number of files going into the file
    2.  the use of << and stop values
    3.  the use of remarks
    4.  the use of permissions

  16. Which of these have to do with executing files without x permissions?
    1.  the period and sh
    2.  buying the sysop a really nice present
    3.  the secret login of the sysop
    4.  The Treasure of the Sierra Madre ("Badges?...")

  17. Which of these does not grant all users execute permissions?
    1.  chmod 751 filename
    2.  chmod u+x filename
    3.  chmod +x filename
    4.  chmod 777 filename

  18. Parameters to a script are also called
    1.  command line arguments
    2.  exported variables
    3.  soft switches
    4.  shell add-ons

  19. With respect to this command:
    	sh scriptname UNIX is Klingonese
    

    What is the value of:

    1.  $0 ______________________________________________
    2.  $2 ______________________________________________
    3.  $# ______________________________________________
    4.  $* ______________________________________________

  20. Debugging may be approached with scripts by using
    1.  the -d option
    2.  the -v option
    3.  the -x option
    4.  the -bug option