Concepts of Programming Languages

(Sean Pound) #1
Programming Exercises 573


  1. Explain type checking in Smalltalk.

  2. The designers of Java obviously thought it was not worth the additional
    efficiency of allowing any method to be statically bound, as is the case
    with C++. What are the arguments for and against the Java design?

  3. What is the primary reason why all Java objects have a common
    ancestor?

  4. What is the purpose of the finalize clause in Java?

  5. What would be gained if Java allowed stack-dynamic objects, as well as
    heap-dynamic objects? What would be the disadvantage of having both?

  6. Compare the way Ada 95 provides polymorphism with that of C++, in
    terms of programming convenience.

  7. What are the differences between a C++ abstract class and a Java
    interface?

  8. Compare the support for polymorphism in C++ with that of
    Objective-C.

  9. Compare the capabilities and use of Objective-C protocols with Java’s
    interfaces.

  10. Critically evaluate the decision by the designers of Objective-C to use
    Smalltalk’s syntax for method calls, rather than the conventional syntax
    used by most imperative-based languages that support object-oriented
    programming.

  11. Explain why allowing a class to implement multiple interfaces in Java and
    C# does not create the same problems that multiple inheritance in C++
    creates.

  12. Study and explain the issue of why C# does not include Java’s nonstatic
    nested classes.

  13. Can you define a reference variable for an abstract class? What use
    would such a variable have?

  14. Compare the access controls for instance variables in Java and Ruby.

  15. Compare the type error detection for instance variables in Java and
    Ruby.


PROGRAMMING EXERCISES



  1. Rewrite the single_linked_list, stack_2, and queue_2 classes
    in Section 12.5.2 in Java and compare the result with the C++ version in
    terms of readability and ease of programming.

  2. Repeat Programming Exercise 1 using Ada 95.

  3. Repeat Programming Exercise 1 using Ruby.

  4. Repeat Programming Exercise 1 using Objective-C.

Free download pdf