These questions are based on the Miranda and Java units and are in no particular order. DISCLAIMER: These are only questions I've provided to guide your study, so while the topics are all relevant, they do not necessarily reflect the kinds of questions that will be on the exam in any way.

  1. Name one advantage and one disadvantage of dynamic typing. ...of static typing.
  2. In language X, you are not required to specify variable types or function return types. What can you conclude about typing in this language and why?
  3. What can you do in a weakly typed language that is impossible in a strongly typed language?
  4. Identify something you can do in a pure functional language that you can't do in an imperative language.
  5. Identify something you can do in an imperative language that you can't do in a pure functional language.
  6. Suppose Mocha is a new version of Java with first class methods. What could you do with Mocha that you couldn't do (very easily, at least) in Java?
  7. Write a Miranda function that can be defined using pattern-matching or guards using both styles.
  8. Is it possible for a language that supports higher order functions to not support currying?
  9. Is it possible for a language that has eager (not lazy) evaluation to support higher order functions?
  10. Write an expression that would be evaluated differently by languages with and without lazy evaluation.
  11. Suppose Miranda-- is just like Miranda, except that it's missing list comprehensions. Are there functions you could write in Miranda that you couldn't write in Miranda-- due to this limitation?
  12. What are the advantages of lazy evaluation?
  13. How do normal and applicative order rewriting differ?
  14. Shallow copy was a potential problem with C++ classes. Given Java's different memory handling, is shallow copy a potential problem in Java?
  15. How does Java treat primitive and class types differently? How...similarly?
  16. Why does Java treat primitive and class types differently?
  17. Argue why it is a bad idea to treat primitive and class types differently.
  18. Are constructors in Java dispatched statically or dynamically?
  19. Are class methods dispatched statically or dynamically?
  20. Suppose you have member data in a class for which you want to enforce the following access restrictions: Describe in words how you would implement this or explain why it is impossible.
    Now consider these restrictions... Describe in words how you would implement this or explain why it is impossible.
  21. Is it possible for a method to be both an override and an overload at the same time?
  22. Explain how you would determine whether a method overloads another method. ...whether a method overrides another method.
  23. What is the difference between an interface and an abstract class?