Quiz 2
3:30 pm class –
November 4th, 2004
Name _______________
Maximum Score: __ Earned Score: _____
- What
are the design issues for character string types?
- page
239 Should strings be simply a special kind of character array or a
primitive type (with no array-style subscripting operations)?
- Should
strings have static or dynamic length?
- What are the two most common problems
with pointers?
- Page
274 & 274 A dangling pointer
- A
lost heap-dynamic variable
- How
would you implement a linked list in a language that didn’t have pointers?
- Using arrays
- Define
row major order.
- Page
257 "In row major order, the
elements of the array that have as their first subscript the lower bound
value of that subscript are stored first, followed by the elements of the
second value of the first subscript and so forth. If the array is a matrix, it is stored
by rows." … a paraphrase of this that is clearer OR the example
below
- Example: If the values in the array were as
shown below, the values would be stored in memory in the order:
c,d,e,f,g,h,i,j,k
c.
|
d.
|
e.
|
f.
|
g.
|
h.
|
i.
|
j.
|
k.
|
- What array operations are provided
specifically for single-dimensioned arrays in Ada?
- Page
252-253 catenation OR
- Page
255 slices (those consisting of
consecutive elements of a single-dimensioned array)
Quiz 2
5:00 pm class –
November 4th, 2004
Name _______________
Maximum Score: __ Earned Score: _____
- What
is a descriptor ?
- Page
235 – A descriptor is the collection of attributes of a variable.
- In
an implementation, a descriptor is the collection of memory cells that
store variable attributes.
- What
are the design issues for arrays?
- Page
248 – What types are legal for subscripts?
- Are
subscripting expressions in element references range-checked?
- When
are subscript ranges bound?
- When
does array allocation take place?
- Are
ragged or rectangular multidimensional arrays allowed, or both?
- Can
arrays be initialized when they have their storage allocated?
- What
kinds of slices are allowed, if any?
- Define
column major order.
- Page
257 –" In column major order, the elements of an array that have as
their last subscript the lower bound value of that subscript are stored
first, followed by the elements of the second value of the last
subscript, and so forth. If the
array is a matrix it is stored by columns." a paraphrase
of this that is clearer OR the example below
- Example: If the values in the array were as
shown below, the values would be stored in memory in the order:
c,f,i,d,g,j,e,h,k
c.
|
d.
|
e.
|
f.
|
g.
|
h.
|
i.
|
j.
|
k.
|
- What
are the advantages of user-defined enumeration types?
- age
245 – readability and reliability
- What
array initialization features is available in Ada that is not available in
other common imperative languages?
- Page
252 – it can assign elements to an index position using the =>
operator, which in Ada is called an arrow. OR
- Example: bunch : array (1..5) or integer := (1
=> 3, 3 => 4, others => 0);