ICS 313: Fundamentals
of Programming Languages (991) Section:
03
Date: 27th
November 1999 Quiz
#3 Time:
20 Minutes
Question 1:
Answer only
four of the following parts (8
points)
i)
What are the three characteristic
features of object-oriented languages?
Abstract Data
Types (ADT) Inheritance Polymorphism
ii) What
is the difference between single and multiple inheritance?
In a single
inheritance a class inherits from a single parent class while in a multiple
inheritance a class inherits from a multiple parent classes
iii) What
is the difference between the definition and implementation modules
of Modula-2?
The definition
module is the interface between the object and the outside world that contains
all the information that is needed to use the object. The implementation module
contains all the implementation details that are hidden from outside the
object.
iv) Define
the concept of polymorphism in Object-Oriented languages?
Polymorphism
refers to the mechanism in which a method is defined in an object then it
produces a different output with the same call based on the subclass that
replied to it.
v) What
is the difference between private and limited private types?
Private types
are types that can be seen within the objects of the class, while limited
private are types that can be seen with some other objects called friends of
the object.
Question
2:
a) Briefly
explain two of the design issues for Object-Oriented languages (4
points)
The design
issues that should be considered include: (1) The exclusivity of objects, (2)
Are subclasses subtypes, (3) Implementation and interface inheritance, (4) Type
checking and polymorphism, (5) Single and multiple inheritance, (6) Allocation
and deallocation of objects, and (7) Dynamic and static binding
b) Briefly explain inheritance
and encapsulation in Java. (3
points)
Inheritance:
Java directly supports single inheritance. However, it can support multiple
inheritance, indirectly, through the use of virtual class called interface.
Encapsulation: Java
has two classes of encapsulation constructs, classes and packages. A package is
a logical, rather than physical, encapsulation