19 Questions
Arrays in imperative and object-oriented programming languages can be understood as mappings from type S to type T?
True
The cardinality of S → T is always equal to #(S) multiplied by #(T)?
False
A mapping m : S → T means that every value in set S is mapped to every value in set T?
False
If m1 = {u → a, v → c} and m2 = {u → c, v → c}, then the image of v under m1 is c?
True
In Ada, the index range for arrays may include Float as a primitive (sub)type.
False
The type of a function with a single argument of type S and its result of type T is represented as S → T.
True
The type declaration 'type Pixel is array (Color) of Boolean;' creates an array of Booleans indexed by the elements of 'Color'.
True
"type Xrange is range 0 .. 511; type Yrange is range 0 .. 255; type Window is array (YRange, XRange) of Pixel;" The cardinality of the 'Window' type, which is an array of 'Pixel', is 8^256 × 512.
True
In a disjoint union, a value is chosen from one of several different types represented by S + T.
True
What is the cardinality of the type 'Integer-List' defined as nil + cons(Integer × Integer-List)?
Uncountably infinite
In the context of lists, what does it mean for a list to be heterogeneous?
The components in the list are of different types
What is the primary characteristic of a recursive type?
It is defined in terms of itself
In the context of lists, what is the purpose of the tail of a non-empty list?
It contains all but the first component of the list
What differentiates a composite type from a primitive type?
Composite types consist of multiple other types, while primitive types do not
Which of the following best describes the data structure used in the given Java list class declaration?
Linked list with integer data and a reference to the next linked list node
"type IntNode; type IntList is access IntNode; type IntNode is record data: Integer; tail: IntList; end record;" In the given Ada list type declaration, what does the 'access' keyword indicate about the 'IntList'?
It indicates that 'IntList' is a pointer to another 'IntNode'
What is the fundamental difference between how strings are treated in Haskell and Ada?
Haskell treats strings as lists of characters, while Ada treats strings as arrays of characters
Which programming languages are examples of statically typed languages?
Ada and Haskell
What is the distinguishing feature of dynamically typed programming languages?
Values have fixed types, but variables and expressions do not
Test your understanding of values and types, including primitive, composite, and recursive types, as well as static vs dynamic typing. Explore the concept of mappings and how to express mappings from one set to another.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free