Lecture 11: Compound/Composite Data Types

 0    11 flashcards    up804653
mp3 indir Baskı oynamak kendini kontrol et
 
soru English cevap English
What are the most common compound data types
öğrenmeye başla
[1] arrays; [2] strings; [3] records; [4] structs; and [5] variant records.
what are arrays
öğrenmeye başla
Arrays are the most common compound/composite type found in programming languages.
What are the attributes of arrays
öğrenmeye başla
[1] the type of its elements. This is also the type of the composite type. [2] the type of its indices. Integers are normally used, but other type is possible, e.g., enumerated type. [3] the number of elements (or index range).
Describe static arrays
öğrenmeye başla
[1] Static arrays: subscript ranges (i.e., sizes of arrays) are statically bound and storage allocation is static (at compile time) [2]e.g., Pascal arrays, C/C++ arrays that include static modifier [3] Advantage: efficiency (no dynamic allocation)
describe Stack-dynamic arrays
öğrenmeye başla
[1] subscript ranges R dynamically bound, the storage allocation is at run-time. Lives on stack. size is fixed [2]E.g. C/C++ arrays w/out static modifier: double balance[10] [3] Advantage: flexibility (array size need not be known til the array is used)
describe Heap-dynamic arrays
öğrenmeye başla
[1] lives on heap and can change size. [2] C++ (via pointer), JavaScript, Python, etc. support these [3]E.g. in C++ myType *heapArray = new myType[100]; delete [] heapArray; [4] Advantage: flexibility (arrays can grow or shrink during program execution)
what are Heterogeneous Arrays
öğrenmeye başla
[1] A heterogeneous array is one in which the elements need NOT be of the same type. [2] Supported by Perl, Python, JavaScript.
What is a Jagged Array
öğrenmeye başla
A jagged array has rows with varying number of elements (but has no concept of columns). Therefore a jagged multiple-dimensional arrays are actually arrays of arrays.
What is a rectangular array
öğrenmeye başla
A rectangular array is a multi-dimensioned (e.g., 2D) array in which all of the rows have the same number of elements and all columns have the same number of elements
What are Records?
öğrenmeye başla
A record is composed of a number of named elements of data.
describe Structs versus Classes
öğrenmeye başla
Structurally, structs are similar to classes (without constructors), and “member function” is an alternative term for “method”.

Yorum yapmak için giriş yapmalısınız.