Quiz Stuff

Quiz 8, March 14, 2018
2'30"; ½ point each; 2.5 points total

  1. Name a statically typed language and a dynamically typed language.
  2. How can we quickly tell whether a Ruby identifier is a global variable?
  3. What's the fundamental characteristic of duck typing?
  4. In Ruby's world, what is an iterator?
  5. What keyword does an iterator use to invoke a block?

EC ½ point: What's a "sigil"? (OK to just show an example.)

Answers

  1. Name a statically typed language and a dynamically typed language.
    Java and Ruby
  2. How can we quickly tell whether a Ruby identifier is a global variable?
    Preceded by a dollar sign: $x
  3. What's the fundamental characteristic of duck typing?
    Writing methods in a style that's unconcerned about the types of parameters.
  4. In Ruby's world, what is an iterator?
    A method that can invoke a block.
  5. 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.