Chapter 6.3 Flashcards

(13 cards)

1
Q

What is the purpose of level numbers in COBOL records?

A

They indicate the hierarchical structure of the record.

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

Define fully qualified and elliptical references to fields in records.

A

Fully qualified: Names all enclosing records from the largest down to the specific field.

Elliptical: Names the field but omits some enclosing record names (as long as it is unambiguous).

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

What is the primary difference between a record and a tuple?

A

A tuple is similar to a record, except that the elements are not named.

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

Are the tuples of Python mutable?

A

No, Python tuples are immutable.

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

What is the purpose of an F# tuple pattern?

A

It is used on the left side of a let statement to assign values to a sequence of names from a tuple (multiple assignment).

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

In what primarily imperative language do lists serve as arrays?

A

Python.

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

What is the action of the Scheme function CAR?

A

It returns the first element of its list parameter.

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

What is the action of the F# function tl?

A

It returns the tail of the list (the list minus the first element).

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

In what way does Scheme’s CDR function modify its parameter?

A

It does not modify the parameter; it returns a new list consisting of the parameter list minus its first element.

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

On what are Python’s list comprehensions based?

A

They are based on set notation and the Haskell language.

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

Define union, free union, and discriminated union.

A

Union: A data type whose variables may store different type values at different times.

Free union: A union with no language support for type checking (no tag).

Discriminated union: A union that includes a type indicator to allow type checking.

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

What are the design issues for unions?

A

The issues are whether type checking should be required and whether unions should be embedded in records.

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

Are the unions of Ada always type checked?

A

Constrained variant records are checked statically; unconstrained are checked dynamically.

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