Ch4 File Globbing Exam

  1. Which of the following is not used for globbing?

    • *
    • [ ]
    • ?
    • #
  2. How many times can you use a * glob character in a pattern?

    • Two
    • No limit
    • Three
    • One
  3. Assuming at least one file matching the pattern is in the current directory, the command echo a* will display:

    • Only the file named “a*”.
    • All of the files in any directory that begin with an “a” character.
    • All of the files in the current directory that begin with an “a” character.
    • All of the files in the current directory that begin with an “a” or “A” character.
  4. Assuming at least one file matching the pattern is in the current directory, the command echo ???a will display:

    • All of the files in the current directory that have four characters in the file name with the last character being an “a” character.
    • Only a file named ???a
    • All of the files in the current directory that end with an “a” character.
    • All of the files in the current directory that have four characters in the file name with the first character being an “a” character.
  5. Which of the following characters can be used to negate (indicate not matching the following characters), when placed as the first of a set of characters enclosed in square brackets [ ] ?

    (choose two)

    • ^
    • ?
    • !
    • ~
  6. The range defined inside of square brackets is based on the:

    • ASCII text table
    • ANSI text table
    • Invalid question as ranges are not permitted
    • Standard text table
  7. To view the ASCII text table in Linux, you can use the following command:

    • text
    • echo ASCII
    • ascii
    • view ascii
    • ls ascii
  8. Within square brackets, (for example: [?]) the ? character means:

    • Match zero or more of any ? characters
    • Exactly one character
    • Nothing, it has no meaning at all
    • Match a ? character
  9. You can combine glob characters in a single pattern, for example: a??*[0-9].

    True or False?

    • True
    • False
  10. Which command will display more information about globbing?

    • man -7 glob
    • man 7 glob
    • man 7 globbing
    • man globbing
  11. Which of the following will match files that have the string hello somewhere in the file name?

    • echo *hello*
    • echo hello*hello
    • echo *hello
    • echo hello*
  12. The glob pattern [a-d] would match:

    • A file name with a single character that is either a a, b, c, or d.
    • A file name with a single character that is either an a, -, or d.
    • All files
    • Nothing, this is an invalid glob pattern.
  13. The glob pattern [!abc]*

    • All files that start with either of the following characters: !, a, b or c.
    • Nothing, this is an invalid glob pattern
    • All files that start with any character except a, b or c
    • All files
  14. Which glob character matches exactly one character?

    • .
    • [
    • ?
    • *
  15. Which glob character matches zero or more characters?

    • *
    • ?
    • [
    • .
  16. Which two characters match a single character from a set of specified characters?

    • ??
    • []
    • ..
    • **
  17. Which two characters represent the empty string?

    • &&
    • **
    • ..
    • ""
  18. Which of the following are glob characters?

    (choose three)

    • The asterisk * character
    • The question mark ? character
    • The dash - character
    • The square brackets [] notation
  19. Brackets can be used to represent a range of characters.

    True or False?

    • True
    • False
  20. Which of these commands would return the files /etc/game.conf, /etc/file.conf and /etc/snap.conf

    (choose two)

    • echo /etc/*?.*o?
    • echo /etc/????.*f
    • ls /etc/????.????
    • ls /etc/p????.**