Recursive and Algebraic Data Types Flashcards

1
Q

What are the two kinds of types, scalar and composite?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a type that is not defined in terms of any other type, and what are the Java examples?

A

Primitive types (basic building blocks for other data types)
In Java: int, short, long, byte, char, float, double, boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the simplest data type: exactly two values (true, false)

A

Boolean type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the type of data that consist of numbers, which can be computed mathematically with various standard operators +, -, *, /

A

Numeric type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the type where the values belong to a finite range of integer values?

A

Ordinal type

All integer types are ordinal
Characters are ordinal
Booleans are ordinal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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?

A

Composite type

Record (or union), Array, Set, List, map, Pointer (or reference)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly