Exam 2
T/F A Boolean variable can hold only two values
true
In python, what is the value returned by 7 % 2
1
what is the value returned by 5 // 2
2
T/F logical operator determines whether a specific relationship exists between two values
true
T/F string comparisons are done using the ASCII code
true
what is the decimal value of the binary number 0000110
6
In python, between all the logical operators, the Not operator has lower precedence than _____
AND
what is the binary number of the decimal number 10 A. 00001110 B. 00000111 C. 00001011 D. 00001010
D
if the following pseudocode was coded and run, what would display, given that rate = 8? Select rate: Case 10: Display "Ten" Case 9: Case 8: Display "Eight" Case 7: Case 6: Display "Six" Default: Display "Rating not possible." End Select
Eight
T/F The AND operator will evaluate to False only if both subexpressions are also False
False
T/F The short-circuit evaluation is always performed with all expressions that contain any logical operators
False
T/F the OR operator will evaluate to FALSE only if both subexpressions are also True
False
If an expression is False, the ___ operator will return True
NOT
which of the following operators is used in most languages to test if two operands do not have the exact same value
!=
T/F A nested decision structure can achieve the same logic as a case structure
True
T/F A nested decision structure can be used to test more than one condition
True
T/F In many languages the == operator determines whether one variable has the same value as another variable
True
in a flowchart, the ___ symbol indicates that some condition must be tested
diamond
A case structure is a ___ alternative decision structure
multiple