Question types

Start with

Question limit

of 29 available terms

Print test

17 Matching questions

  1. The regular expression {3,} matches
  2. Regular expressions can be very difficult at times to debug.
  3. True or false: if "foobar" =~ /(foo|bar|baz)/
  4. Comments in Perl begin with a : (colon).
  5. Consider the following statement: @words = split/\s+/, $x; This statement examines $x and creates array @words by splitting string $x on the following delimiter: (Mark ALL that are true)
  6. In Perl replacement strings, groupings matched in the search expression may be referred to by matching variables $1, $2, $3, etc.
  7. Perl is not case sensitive.
  8. After executing the Perl statements, what will $string contain?
    $string = "Cowan, Ted";
    $string =~ s/d/ddy/;
  9. Using regular expressions, strings can be matched by class, such as alphabetic, numeric and whitespace characters.
  10. What is a regular expression?
  11. After executing the following, what will $y contain? $y = "Mickey Mouse"; $y =~ s/^(.)\s+(.)$/$2, $1/;
  12. s/^$/ matches:
  13. if "foobar" =~ /^bar/ is
  14. After executing the following Perl statements, what variable will contain only the string "test"?

    $x = "this is a test";
    @words = split/\s+/, $x;
  15. The statement "s/foo/bar/g" will replace only the first "foo" with "bar" in the string being searched.
  16. Perl regular expressions .* (dot star) and .+ (dot plus) will never match more than one character.
  17. Which of these regular expressions matches the entire string "bar"?
  1. a True
  2. b True
    If you don't think so, your regular expressions are not sufficiently robust.
  3. c /bar/
  4. d A syntax for searching and replacing strings in Perl. Regular expressions are a means of searching strings of text, a prominent feature of Perl.
  5. e "Mouse, Mickey"
    the expression s/^(.)\s+(.)$/$2, $1/; groups two words separated by whitespace and reverses those words with a comma and space between them.
  6. f $words[3]
  7. g False
  8. h an empty line
  9. i a single space
    multiple whitespace characters
    This instance of split uses /\s+/ as the delimiter, which is interpreted to mean one or more whitespace characters.
  10. j False
    ^bar means find the string "bar" at the beginning of the string being searched.
  11. k False
    Regular expressions will match as much of the strings as possible.
  12. l True

    (foo|bar|baz) will match any of the words foo, bar or baz.
  13. m True A class is a type of character, such as alphabetic (a-z, A-Z), numeric (0-9) and white space (tab, space and newline)
  14. n three or more of the preceding object
  15. o False

    s/foo/bar/g will replace ALL instances of foo in the search string with bar because of the "g" (global) modifier.
  16. p Cowan, Teddy
  17. q False

    Comments begin with a # (hash mark)