Selamat Datang di Blog Saya. Blog ini dibuat untuk memenuhi tugas dari dosen saya tercinta Bapak Ir.Tri Djoko Wahjono , M.Sc . Kiranya Blog ini bisa menambah pengetahuan bagi kalian. Isi blog ini mengenai konsep bahasa pemrogramman. Dan blog ini di sponsori oleh Bina Nusantara Alam Sutera.
Posted by : Unknown Minggu, 02 November 2014

Name : Romy Hermawan
NIM    : 1801378902
Class : LD001
Lecturer: Ir. Tri Djoko Wahjono,M.Sc

REVIEW QUESTION:
6. What are the advantages of user-defined enumeration types?
Answer:

Improved writability and readibility, No arithmetic operations are legal on enum types and no enumeration types can be assigned values outside its defined range.

7. In what ways are the user-defined enumeration types of C# more reliable than those of C++?
Answer:

C# enumeration types are like those of C++, except that they are never coerced to integer. So, operations on enumeration types are restricted to those that make sense. Also, the range of values is restricted to that of the particular enumeration type.

8.What are the design issues for array

Answer:
What types are legal for subscripts?
Are subscripting expressions in element references range checked?
When are subscript ranges bound?
When does array allocation take place?
Are ragged or rectangular multidimensioned arrays allowed, or both?
Can arrays be initialized when they have their storage allocated?
What kinds of slices are allowed, if any?

9.What happens when an nonexistent element of an array is referenced in Perl ?
Answer:
– If you try to append non-existent elements from an array to another one, the initial array will grow as needed, even though the elements to append do not exist.

10. What happens when a nnexistent element of an array is referenced in Perl?
Answer:
A reference to a nonexistent ele-ment in Perl yields undef, but no error is reported.

SET PROBLEM:


6. Explain all of the differences between Ada’s subtypes and derived types.
Answer:
An Ada subtype is a possibly range-constrained version of an existing type. A subtype is type equivalent with its parent type. while a derived type is a new type that is based on some previously defined type with which it is not equivalent, although it may have identical structure. Derived types inherit all the properties of their parent types.

7. What significant justification is there for the -> operator in C and C++?
Answer:
The only justification for the -> operator in C and C++ is writability. It is slightly easier to write p -> q than (*p).q.

8. What are all of the differences between the enumeration types of C++ and those of Java?
Answer :
In Java they can include fields, constructors, and methods. The possible values of an enumeration are the only possible instances of the class. All enumeration types inherit to String, as well as a few other methods. An array of the instances of an enumeration type can be fetched with the static method values. The internal numeric value of an enumeration variable can be fetched with the ordinal method. No expression of any other type can be assigned to an enumeration variable. Also, an enumeration variable is never coerced to any other type.

9.The unions in C and C++ are separate from the records of those languages, rather than combined as they are in Ada. What are the advantages and disadvantages to these two choices?
Answer :


Advantage : Unconstrained variant records in Ada allow the values of their variants to change types during execution.

Disadvantage: The type of the variant can be changed only by assigning the entire record, including the discriminant.

10. Multidimensional arrays can be stored in row major order, as in C++, or 
in column major order, as in Fortran. Develop the access functions for 
both of these arrangements for three-dimensional arrays
Answer:
Let the subscript ranges of the three dimensions be named min(1), min(2), min(3), max(1), max(2), and max(3). Let the sizes of the subscript ranges be size(1), size(2), and size(3).
Assume the element size is 1.
Row Major:
location(a[i,j,k]) = (address of a[min(1),min(2),min(3)]) +((i-min(1))*size(3) + (j-min(2)))*size(2) + (k-min(3))
Column Major:
location(a[i,j,k]) = (address of a[min(1),min(2),min(3)]) +((k-min(3))*size(1) + (j-min(2)))*size(2) + (i-min(1))

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

Diberdayakan oleh Blogger.

- Copyright © Binusian IT 2018(Concept of Programming Language) -Metrominimalist- Powered by Blogger - Designed by Romy Hermawan -