- 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.
- Two minutes and 30 seconds; five questions, plus an extra credit question.
- Can everybody see this line?
Quiz 8, March 14, 2018
2'30"; ½ point each; 2.5 points total
- Name a statically typed language and a dynamically typed language.
- How can we quickly tell whether a Ruby identifier is a global variable?
- What's the fundamental characteristic of duck typing?
- In Ruby's world, what is an iterator?
- What keyword does an iterator use to invoke a block?
EC ½ point: What's a "sigil"? (OK to just show an example.)
Answers
- Name a statically typed language and a dynamically typed language.
Java and Ruby
- How can we quickly tell whether a Ruby identifier is a global variable?
Preceded by a dollar sign: $x
- What's the fundamental characteristic of duck typing?
Writing methods in a style that's unconcerned about the types of parameters.
- In Ruby's world, what is an iterator?
A method that can invoke a block.
- What keyword does an iterator use to invoke a block?
yield
EC: What's a "sigil"?
A character preceding an identifier that indicates something about the nature of the named object.
Example: Ruby global variables are prefixed with a dollar sign.