Chapter 6 Flashcards
What is a data type?
A collection of data values and a set of predefined operations on those values.
What is a variable’s descriptor?
A collection of attributes.
What is a primitive data type?
Built-in data types.
What are some examples of primitive data types?
Integers, floating point, complex (FORTRAN, Python), decimal, boolean, and char
How are these primitive data types stored or represented? Non-aggregate. ints, floats, chars, etc.
As a string of bits in memory.
For character/string data types, what are the major design issues?
-Should they be static or dynamic?
-Are they built-in or not?
-What operations are allowed?
-How to store the string?
-How can we store dynamic strings?
-How to indicate length?
What is an array?
A contiguous chunk of memory of the same data type.
What are the design issues associated with arrays?
-What are the legal indices?
-Are accesses range-checked?
-When does a range for an array get bound?
-When is the memory allocated?
-Can multidimensional arrays be jagged? Rectangular? Both?
-Can you slice an array?
What is a rectangular array?
A multidimensioned array in which all of the rows have the same number of elements and all of the columns have the same number of elements.
What is a jagged array?
An array where the lengths of the rows need not be the same.
What is a slice of an array?
Some substructure of that array
What is an associative array? How is this different than a regular array?
An unordered collection of data elements that are indexed by an equal number of values called keys. Keys need to be stored in the structure, which differs from regular arrays.
What is a record type?
An aggregate of data elements in which the individual elements are identified by names and accessed through offsets from the beginning of the structure.
How do various languages implement records? For example, how does C implement a record?
C, C++, C#, and Swift: structs
What is a tuple?
A collection which is ordered and unchangeable. Similar to records, but the elements are unnamed.