You are on page 1of 3

CSE 3302 Quiz 5

1. Choose whether true or false: -


a. Data in its most primitive form is simply a collection of bits.
b. All numeric integer types are ordinal types.
c. Anonymous typing is a process of attaching types to expressions.
d. Real numbers are not ordinal.
e. Real numbers have no successor and predecessor operations.
f. Predefined types are sets whose elements are named and listed explicitly.
g. In Ada, range errors in array subscripting, can be caught prior to execution.
h. All numeric integer types always have comparison operators.
i. In a record structure, components have names.
j. A language with un-discriminated unions has an unsafe type system.
k. Unions are not needed in object-oriented languages.
l. A data type is a mathematical algebra.
m. Polymorphism allows names to have multiple types while still permitting static type
checking.
n. In un-discriminated unions, a tag or discriminator is added to the union to distinguish
the type of its elements.
o. In Ada, all type errors cause compilation error messages.

2. Chose correct answer: -


a. Which one is a strongly typed language-
i. C
ii. Scheme
iii. Ada
iv. Both C and Ada
b. In which language variables have no predeclared types
i. C
ii. Scheme
iii. Ada
iv. C++
c. Type errors cause program termination in
i. C
ii. Scheme
iii. Ada
iv. C++
d. In Java, primitive types include
i. Array
ii. Class
iii. Boolean
iv. Interface
e. In C, primitive types include
i. Void
ii. Integral
iii. Boolean
iv. Float
f. Heap is used rather than pointer and recursive type in
i. C
ii. Ada
iii. C++
iv. Both ii and iii
g. Recursive type is a type that
i. Uses itself in its declaration.
ii. Type with no name
iii. Can be used as a value and manipulated by the programming.
iv. None of the above.
h. Declaration of array types without size are allowed in
i. C
ii. Ada
iii. C++
iv. Both i and iii
i. Arrays are always dynamically allocated in
i. C
ii. Ada
iii. Java
iv. Scheme
j. Union type constructor creates un-discriminated unions in
i. C
ii. Ada
iii. C++
iv. Both i and iii

3. Give an example of
a. Recursive types in C.
b. Union in C.
c. A Tuple in ML
d. A subtype in Ada
4. struct stA{ stA b;
char x; struct stA c;
int y; struct {
} a; char x;
typedef struct stA stA; int y;
Struct stA a; } d;

Among a, b, c, d which ones are structurally equivalent and which ones are name
equivalent?

5. Bonus Credit: -
In C, define a function type from chars to chars and use this type for variables or
parameters.

You might also like