Ch8 Regular Expressions Exam

  1. If you want to use grep without regard to the capitalization of text, you can use the option:

    • -v
    • -r
    • -t
    • -i
  2. The regular expression a? is equivalent to:

    • a{0,1}
    • a{1,}
    • a{1}
    • a{0,}
  3. The regular expression a* is equivalent to:

    • a{1}
    • a{0,1}
    • a{0,}
    • a{1,}
  4. The regular expression a+ is equivalent to:

    • a{1,}
    • a{0,1}
    • a{0,}
    • a{1}
  5. To get the grep command to show the names of files that matched instead of the content that matched, you can use the option:

    • -l
    • -n
    • -q
    • -f
  6. To use extended regular expressions, you can use:

    (choose two)

    • grep -E
    • egrep
    • grep -e
    • fgrep
  7. To use regular expression characters to match themselves, you cannot:

    • Put the character in the square brackets
    • Use the slash in front of the character
    • Use the fgrep command
    • Use the backslash in front of the character
  8. What does the vertical bar | character do in a regular expression?

    • Separates repetition modifiers
    • Separates alternative patterns that can be matches
    • Redirects input to the command
    • Redirects output from the command
  9. What is not a purpose of using parentheses around parts of a regular expression?

    • They can be used to group characters for repetition
    • They can be used to refer back to what was matched
    • They can be used to make alternation more efficient
    • They can be used to change the order that the pattern is evaluating
  10. What is the reason you would use the grep command with a quiet -q option?

    • You do not want to write anything to standard output
    • You don’t want grep to make noise
    • You want the output to be redirected to a file
    • You want the output to be small
  11. Which of the following regular expression characters is an extended regular expression character?

    • *
    • $
    • .
    • +
  12. Which option for the grep command will invert the pattern matching results?

    • -o
    • -v
    • -r
    • -i
  13. Which regular expression character matches any one character?

    • *
    • .
    • ?
    • +
  14. Which regular expression character matches one or more of the previous character?

    • *
    • $
    • +
  15. Which regular expression character matches zero or more of the previous character?

    • .
    • +
    • ?
    • *