Thursday, June 27, 2013

Concepts of Programming Languages Chapter 11


Concepts of Programming Languages Chapter 11


Name            : Erland
NIM              : 1601218035
Lecturer       : Tri Djoko Wahjono, Ir., M.Sc. (D0206)
Assignment  : Concept of programming languages Chapter 11

Review Questions


       2.   Define abstract data types
             Answer :  
-The representation of objects of the type is hidden from the program units that use the type-The declarations of the type and the protocols of the operations on objects of the type
       3.   What are the advantages of the two parts of the definition of abstract data type
            Answer : 
-The program will increase reliability, reduce the range of code and number variables
-It provides a method of organizing a program into logical units that can be compiled separately.
       5.   What are the language design issues for abstract data types
             Answer :
-the form of the container for the interface to the type
-whether abstract data type can be parameterized
-what access controls are provided and how such controls are specified
-whether the specification of the type is physically separate from its implementation
       6. Explain how information hiding is provide in Ada package?
            Answer :
the designer can define a data type to choose and make the type entirely visible to clients or provide only the interface information.
       7. To what is the private part of an Ada package specification visible?
             Answer : 
To the compiler but not to the client programs
       8. What is the difference between private and limited private types in Ada?
           Answer : 
-Private types in Ada, it has built-in operations for assignment and comparisons for equality and inequality.
-Limited private types in Ada, are described in the private section of a package specification, as are non pointer private types. Limited private types are declared to be 

        9.  What is in an ada package specification? What about a body package?
             Answer:
A package specification and its associated body package share the same name. The reserved word body in a package header identifies it as being a body package. A package specification and its body package may be compiled separately.

        10.what is the use of Ada with clause?
              Answer : 
To make the names defined in external packages visible

       11. What is the use of Ada use clause?
             Answer :
To eliminate the need for explicit qualification of the references to entities from the named package.
       12. What is the fundamental difference between a C++ class and an Ada package?
             Answer : 
C++ classes are types ; as stated previously, Ada packages are more generalized encapsulations that can define any number of types. Ada packages can access any of its public entities directly by their names. a C++ program unit that declares an instance of a class can also access all of the public entities in that class, but only through an instance of the class.
       13. From where are C++ objects allocated?
             Answer : 
from heap memory are C++ objects allocated 
       15. What is the purpose of a C++ destructor?
             Answer :
Destructor is often used as a debugging aid, in which case they simply display or print the values of some or all of the object's data members before those member are deallocated.