Unit 2 - Numbers, Arithmetic, Expression trees Flashcards

1
Q

A notable exception is Lisp where multiplication can
take any number

A

of operands (ie it has a mixed arity)

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

Java automatically inserts integers to float conversions where necessary but *****
does not.

Thus in **, we have to write ** where in Java 2 is sufficient.

A

Ada

2.0

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

Haskell does not insert any conversion, but instead it

A

works out from the context that 2 is a float rather than an integer.

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

Integer CPU types usually come in two flavours: (and ranges)

A

singed and unsigned.

An unsigned 8-bit integer, has the range 0 . . . 255.

A signed 8-bit integer type has the range −128 . . . 127.

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

A floating-point overflow happens only when

A

the exponent does not fit in the available space.

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

An overflow upwards (ie for a very large positive number) is

A

rounded to positive infinity (∞)

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

an overflow downwards (ie for a very large negative number) is

A

rounded to negative infinity (−∞).

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

Positive and negative infinities are

A

are special values of floating-point types.

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

A floating-point underflow is a situation where the result of an operation is

A

so close to 0 that the exponent is a very large negative number.

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

An underflow usually results in

A

rounding the number to 0.

This does not happen easily because floating-point types are most accurate near 0.

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