Data Types Flashcards
defines a collection of data values and a set of predefined operations on those values
data type
Data types that are not defined in terms of other types are called
primitive data types
The primitive data types of most imperative languages include …
numeric, Boolean, and character types
has range of values that has only two (2) elements, one for true and one for false
Boolean data type
is used to store only a single character. Examples of characters include letters, numerical digits, common punctuation marks, and whitespace
character data type
Numeric type includes
Integer, floating-point data types, decimal data types
is the most common primitive numeric data type
integer
model real numbers, but the representations are only approximations of many real numbers.
floating-point data types
store a fixed number of decimal digits, with the decimal point at a fixed position in value
decimal data types
has values that consist of sequences of characters
character string (or string) type
The most common string operations are? (5)
assignment, concatenation, substring reference, comparison, and pattern matching
What are the three string length options? (3)
Static length string, Limited dynamic length string, Dynamic length string
The length of string values can be fixed and set when the string is created
Static length string
The length of string values can have varying length up to a declared and fixed maximum set by the variable’s definition.
Limited dynamic length string
The length of string values can have varying length with no maximum
Dynamic length string
consist of range of possible values that can be easily associated with the set of positive integers
ordinal type
Two (2) user-defined ordinal types
- Enumeration type
- Subrange type
is one in which all of the possible values, which are name constants, are provided, or enumerated, in the definition.
enumeration type
represents a subset of the values in another ordinal type
subrange type
is a container object that stores a fixed number of values of a single type
array
The individual elements of an array are reference using a … or …
subscript or index
Five (5) categories of arrays based on the binding to subscript ranges, the binding to storage, and from where the storage is allocated
- Static array
- Fixed stack-dynamic array
- Stack-dynamic array
- Fixed-heap dynamic array
- Heap-dynamic array
has subscript ranges that are statically bound and its storage allocation is static
static array
has subscript ranges that are statically bound, but its allocation is done at declaration elaboration time during execution
fixed stack-dynamic array
has subscript ranges and storage allocation that are both dynamically bound and can change during the array’s lifetime multiple times
heap-dynamic array
The most common array operations are
assignment, concatenation, comparison for equality and inequality, and slices
is a multidimensional array in which all of the rows and columns have the same number of elements
rectangular array
consists of rows with different number of elements
jagged array
After extracting certain elements from an array, another array is produced called a …
slice
is an unordered collection of data elements that are indexed by an equal number of values called keys
associative array
is a collection of data elements in which the individual elements are identified by names and accessed through offsets from the beginning of the structure
record
is a data type that is similar to a record, except that the elements are not named
tuple
represents are ordered sequence of values, which is usually not separated by any punctuation
list
is a type whose variables may store different type of values at different times during program execution
union
Unions in programs that are free from type checking are called …
free unions
Type checking of unions requires that each union construct include a type indicator. Such indicator is called a tag, or discriminant, and a union with a discriminant is called a …
discriminated union
is one in which the variables have a range of values that consists of memory addresses and a special value called nil
pointer type
The .. value is not a valid address and is used to indicate that a pointer cannot currently be used to reference a memory cell
nil
A pointer can be used to access a location in an area where storage is dynamically allocated called a …
heap
Variables that are dynamically allocated form the heap are called …
heap-dynamic variables
Variables without names are called …
anonymous variables
Two (2) fundamental pointer operations
- Assignment
- Deferencing
variable that refers to an object or a value is memory
reference type
is the activity of ensuring that the operands of an operator are of compatible types
type checking
The process automatically converting an operator is called a …
coercion
is the application of an operator to an operand of an inappropriate type
type error
Type checking at run time is called …
dynamic type checking
A programming language is … if type errors are always detected.
strongly typed
means that two (2) types are equivalent if an operand of one (1) type in an expression is substituted for one of the other type, without coercion.
type equivalence
two (2) approaches to defining type equivalence are
- name type equivalence
- structure type equivalence
two (2) fundamental pointer operations
- Assignment
- Dereferencing
sets a pointer variable’s value to some useful address
Assignment
takes a reference through one (1) level of indirection
Dereferencing
variable refers to an object or a value is memory
reference type