next up previous
Next: About this document

Computer Science 3675
Summer 2000
Quiz 4

  1. Write a clearly legible T to the left of each of the following that is true, and a clearly legible F to the left of each that is false.
    1. A genuinely strongly typed language such as Standard ML does not need to perform any type checking at run time.
    2. Most object-oriented programming languages are strongly typed.
    3. All programming languages employ types at compile time.
    4. Polymorphism is most useful in creating general purpose libraries.
    5. Object-based programming is centered around the notion of a class.
    6. Under the name equivalance rule, two types with different names must be different types.
    7. An implementation of a typeless language does not do any type checking at all, at compile time or run time.
  2. What is the most general polymorphic type of function f defined by f(x) = tail(left(x))? Function tail takes the tail of a list, and left takes the left-hand member of an ordered pair. Use tex2html_wrap_inline24 and tex2html_wrap_inline26 as type variables. Answer:
  3. Function filter is defined so that (filter p x) returns the list of all members of list x that cause predicate p to return true. For example, suppose that function pos is defined so that pos(n) is true just when n is positive. Then (filter pos [9,-3,8,-2]) = [9,8]. Notice that (filter pos) is a function. What is the most general polymorphic type of filter? Use tex2html_wrap_inline24 and tex2html_wrap_inline26 as type variables. Answer:
  4. Explain how variable selectors are inherited in single-inheritance object-oriented programming languages.




Karl Abrahamson
Mon Jun 19 13:40:17 EDT 2000