Programming Logic and Design, Chapter 4, Review Questions (4-8c)

¡Supera tus tareas y exámenes ahora con Quizwiz!

a

13.Which of the following is a trivial Boolean expression? a. k < b AND k > b b. m = 10 OR m = 20 c. n > 12 OR p > 12 d. q > 10 AND q < 19

c

14.Which of the following is a trivial Boolean expression? a. r < b AND f > b b. r = 10 OR r < 0 c. f > 12 OR f < 19 d. r > f AND f < b

a

3.The greater-than operator evaluates as true when ________. a. the left operand is greater than the right operand b. the right operand is greater than the left operand c. the right operand is equal to the left operand d. Both b and c are true.

b

A expression has one of two values: true or false. a. Georgian b. Boolean c. Barbarian d. Selective

d

A trivial Boolean expression is one that ______. a. is not important b. is complicated c. is always false d. always has the same value

a

If conditionA is 30 percent likely to be true and conditionB is 10 percent likely to be true, then it is most efficient to test conditionA first . a. in an OR decision b. in an AND decision c. in any decision d. never

d

If j <> k is true, then ________. a. j = k is true b. j > k might be true c. j < k might be true d. Both b and c are true.

b

If m is true and n is false, then _____________. a. m AND n is true b. m AND n is false c. m OR n is false d. If m is true, then n must be true.

a

If p is true and q is false, then ____________. a. p OR q is true b. p OR q is false c. p AND q is true d. p is greater than q

c

If x <= y is true, then ________. a. x = y is true b. y <= x is true c. x > y is false d. x >= y is false

b

In a selection, the else clause executes ______. a. when the tested condition is true b. when the tested condition is false c. always d. only after the if clause executes

c

In an AND condition, the most efficient technique is to first ask the question that ___________. a. mixes constants and variables b. uses a less-than or less-than-or-equal-to operator c. is least likely to be true d. uses a named constant

b

In the following pseudocode, what percentage raise will an employee in Department 8 receive? if department < 5 then raise = SMALL_RAISE else if department < 14 then raise = MEDIUM_RAISE else if department < 9 then raise = BIG_RAISE a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell

d

Which of the following is a poorly written, trivial Boolean expression? a. a > b AND b > c b. d = 10 OR d > 20 c. e < f AND g < 100 AND g <> 5 d. h < 10 AND h = 4

d

Which of the lettered choices is equivalent to the following decision? if x > 10 then if y > 10 then output "x" endif endif a. if x > 10 OR y > 10 then output "X" endif b. if x > 10 AND x > y then output "X" endif c. if y > x then output "X" endif d. if x > 10 AND y > 10 then output "X" endif

If a is true, b is true, and c is false, which of the following expressions is true?

a. a OR b AND c b. a AND b AND c c. a AND b OR c d. two of the above D. TWO OF THE ABOVE

If d is true, e is false, and f is false, which of the following expressions is true?

a. e OR f AND d b. f AND d OR e d. two of the above C. d OR e AND f

If sales = 100, rate = 0.10, and expenses = 50, which of the following expressions is true?

a. sales >= expenses AND rate < 1 b. sales < 200 OR expenses < 100 c. expenses = rate OR sales = rate D. TWO OF THE ABOVE

In the following pseudocode, what percentage raise will an employee in Department 10 receive? if department < 2 then raise = SMALL_RAISE else if department < 6 then raise = MEDIUM_RAISE else if department < 10 raise = BIG_RAISE endif endif endif

d. impossible to tell

When you use a range check, you compare a variable to the ______ value in the range

d. lowest or highest


Conjuntos de estudio relacionados

Economics 1 : DEMAND AND SUPPLY ANALYSIS

View Set

Ship Construction and Stability test 1

View Set

الأسئلة الشفوية لمسابقة أستاذ الإبتدائي

View Set