- Use a full sheet of 8½ x 11" paper. (Half sheet? Half credit!)
- Put your last name and first initial in the far upper left hand corner of the paper, where a staple would hit it. (It helps when sorting quizzes!)
Example:
Mitchell, W.
- No need to write out questions.
- Numbering responses may help you avoid overlooking a question; it's ok to go ahead and pre-number your sheet.
- Three minutes; four questions, plus two extra credit questions.
- Can everybody see this line?
Quiz 9, March 26, 2018
3 minutes; 1 + 1 + ½ + ½ points; 3 points total
-
What's the length of the shortest and longest strings described by the following RE?
/(a|bb|[a-z][1-3])/
- What is the value of each of the following Ruby expressions?
/@/ =~ "ab@cd"
/..@../ =~ "ab@cd"
- Write a RE that will match four character strings whose first and last characters are
x
and whose
middle two characters are digits.
- In computer science theory, a language is a set of ______________.
EC ½ point: How many levels does the Chomsky Hierarchy of languages have?
EC ½ point: Tell me something about regular expressions not evidenced above.
Answers
- What's the length of the shortest and longest strings described by the following RE?
/(a|bb|[a-z][1-3])/
Shortest is 1; longest is 2.
- What is the value of each of the following Ruby expressions?
/@/ =~ "ab@cd" => 2
/..@../ =~ "ab@cd" => 0
- Write a RE that will match four character strings whose first and last characters are
x
and whose
middle two characters are digits.
/x\d\dx/
- In computer science theory, a language is a set of strings .
EC ½ point: How many levels does the Chomsky Hierarchy of languages have?
4
EC ½ point: Tell me something about regular expressions not evidenced above.
A regular expression specifies a regular language.