Assignment By Mr. Tri Djoko Wahjono
Review Questions 1. What are the two kinds of abstractions in programming languages?
- Process abstraction and Data abstraction.
2. Define abstract data type.
-An abstract data type is a data structure, in
the form of a record, but which includes subprograms that manipulate its data.
3. What are the advantages of the two parts of the definition of abstract data
-It is a weapon against complexity; a means of making large and/or complicated programs more manageable.
4. What are the language design requirements for a language that supports
abstract data types?
-The representation of objects of the type is hidden from the program units
that use the type, so the only direct operations possible on those objects are
those provided in the type’s definition.
-The declarations of the type and the protocols of the operations on objects
of the type, which provide the type’s interface, are contained in a single
syntactic unit. The type’s interface does not depend on the representation
of the objects or the implementation of the operations. Also, other program
units are allowed to create variables of the defined type.
5. What are the language design issues for abstract data types?
-The first design issue for abstract data types is the form of the container for the interface to the type.
-The second design issue is whether abstract data types can be parameterized.
-The third design issue is what access controls are
provided and how such controls are specified.
15. What is the purpose of a C++ constructor?
-constructors are used to initialize the data members of newly created objects. A constructor
may also allocate the heap-dynamic data that are referenced by the pointer
members of the new object.
17. Where are all Java methods defined?
-Methods in Java must be defined completely in a class.
26. Why does Java not have destructor?
-destructor are obviated by Java’s implicit garbage collection
27. Where are all Java methods defined?
-Methods in Java must be defined completely
in a class.
28. Where are Java classes allocated?
-from the heap and
accessed through reference variables.
-Classes in Ruby are dynamic in the sense that members can be added at
any time. This is done by simply including additional class definitions that
specify the new members. Moreover, even predefined classes of the language,
-One capability that Java 5.0 provides that C# 2005 does not is wildcard classes.