Recursive and Algebraic Data Types Flashcards
What are the two kinds of types, scalar and composite?
Scalar type is a type whose values
- occupy a fixed amount of memory, and
- are atomic, that is, a value is not subdivided further in any way.
Composite type is a type whose values are composed of simpler component values. That is, it is an aggregation of other simpler types.
What is a type that is not defined in terms of any other type, and what are the Java examples?
Primitive types (basic building blocks for other data types)
In Java: int, short, long, byte, char, float, double, boolean
What is the simplest data type: exactly two values (true, false)
Boolean type
What is the type of data that consist of numbers, which can be computed mathematically with various standard operators +, -, *, /
Numeric type
What is the type where the values belong to a finite range of integer values?
Ordinal type
All integer types are ordinal
Characters are ordinal
Booleans are ordinal
What is the type that can be constructed from the language’s primitive data types and other of this type, and what are examples of them?
Composite type
Record (or union), Array, Set, List, map, Pointer (or reference)