What is the value of the bool valued expression, 1 < x < 10? Does the value of this depend on the value of x? Explain, and give the expression that the programmer probably meant.
a. This statement is incorrect as it is always false.
b. This statement is correct and its value depends on x.
c. This statement is incorrect and it is always true
d. This statement is incorrect, but it does depend on the value of x.
c) This expression is always true. The value does not depend on x. This is the mathematicians’ shorthand for what the programmer probably meant:
(1 < x)&&(x < 10)
Explanation: The < operator associates (groups) left to right, so the expression evaluates as (1 < x) < 10 . The expression (1 < x) evaluates to either false or true, regardless of x. These bool values convert to int values 0 or 1 when compared to int value 10 . The expression evaluates to true for all values of x.
You might also like to view...
The most general style rule that can be applied to an element is a(n):
a. id attributes b. Selector with only element names c. Inherited rule d. Selector with more than one class
Method ToString is not a member of class:
a) String b) Object c) StringBuilder d) None of the above
You can use ____ types of links on web pages.
A. two B. three C. four D. six
You can change the AutoSave frequency by displaying the Save As dialog box
Indicate whether the statement is true or false