chapter 4 test

Ace your homework & exams now with Quizwiz!

A ______________expression has one of two values: true or false.

Boolean

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

Both b and c are true.

In the following pseudocode, what percentage raise will an employee in Department 8 receive? if department < 5 thenraise = SMALL_RAISEelse if department < 14 thenraise = MEDIUM_RAISE elseif department < 9 thenraise = BIG_RAISE endif endif endif

MEDIUM_RAISE

Which of the following is a poorly written, trivial Boolean expression? a = 100 OR b > 200 a < b AND c < 100 AND d <> 5 a < 10 AND a > 40 a > b AND b > c

a < 10 AND a > 40

If a is true and b is false, then ______________.

a AND b is false

A trivial Boolean expression is one that ______________.

always has the same value

When you use a range check, you always compare a variable to ______________ value in the range.

an end-of-range value

If d is true, e is false, and f is false, which of the following expressions is true? e OR f AND d f AND d OR e d OR e AND f two of the above

d OR e AND f

Which of the following must always be false? e > 12 OR f > 12 e = 10 OR e = 20 e > 12 AND e < 15 e > 10 AND e < 7

e > 10 AND e < 7

Which of the following must always be true? g = 12 OR h = 17 g > 12 AND g < 21 g < 12 AND g < 18 g <> 12 OR g <> 15

g <> 12 OR g <> 15

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

if x > 10 AND y > 10 then output "X" endif

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

impossible to tell

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 ______________.

in an OR decision

In an AND condition, the most efficient technique is to first ask the question that ______________.

is least likely to be true

If p is true and q is false, then ______________. p is greater than q p OR q is true p AND q is true p OR q is false

p OR q is true

The greater-than operator evaluates as true when ______________.

the left operand is greater than the right operand

If a is true, b is true, and c is false, which of the following expressions is true? a OR b AND c a AND b OR c a AND b AND c two of the above

two of the above

If sales = 100, rate = 0.10, and expenses = 50, which of the following expressions is true? sales < 200 OR expenses < 100 sales >= expenses AND rate < 1 expenses = rate OR sales = rate two of the above

two of the above

In a selection, the else clause executes ______________.

when the tested condition is false

If x <= y is true, then ______________.

x > y is false


Related study sets

AP Biology Unit 2: Cell Structure and Function

View Set

Consumer Behavior Marketing EXAM 1

View Set

Alquimista Preguntas Pagina 93-100

View Set

Participants safety and Adverse events?

View Set