Which of the following statements is false?

a. The following session defines a maximum function that determines and returns the largest of three values—then calls the function three times with integers, floating-point numbers and strings, respectively.
In [1]: def maximum(value1, value2, value3):
...: """Return the maximum of three values."""
...: max_value = value1
...: if value2 > max_value:
...: max_value = value2
...: if value3 > max_value:
...: max_value = value3
...: return max_value
...:

In [2]: maximum(12, 27, 36)
Out[2]: 36

In [3]: maximum(12.3, 45.6, 9.7)
Out[3]: 45.6

In [4]: maximum('yellow', 'red', 'orange')
Out[4]: 'yellow'
b. You also may call maximum with mixed types, such as ints and floats:
In [5]: maximum(13.5, -3, 7)
Out[5]: 13.5
c. The call maximum(13.5, 'hello', 7) results in TypeError because strings and numbers cannot be compared to one another with the greater-than (>) operator.
d. All of the above statements are true.

d. All of the above statements are true.

Computer Science & Information Technology

You might also like to view...

The familiarity and utilization of ________ may result in a situation where investigators know just enough to make them potentially hazardous to the investigation

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Answer the following questions true (T) or false (F)

1. Java does not require that a variable be declared before it is used within a program. 2. A variable of type boolean can be explicitly converted to that of type int.

Computer Science & Information Technology