Python Unit 4

  1. A                  expression has one of two values: true or false.




    C. Boolean
  2. In a selection, the else clause executes




    C. when the tested condition is false
  3. The greater-than operator evaluates as true when




    B. the left operand is greater than the right operand
  4. A trivial Boolean expression is one that




    A. always has the same value
  5. If x <=y is true, then




    B. x > y is false
  6. If j <> k is true, then




    D. Both b and c are true
  7. In an AND condition, the most efficient technique is to first ask the question that




    A. is least likely to be true
  8. If a is true and b is false, then




    D. a AND b is false
  9. If p is true and q is false, then




    C. p OR q is true
  10. Which of the lettered choices is equivalent to the following decision?
    if x > 10 then
    if y > 10 then
    output "X"
    endif
    endif




    D. if x > 10 AND y > 10 then output "X" endif
  11. If a 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




    d never
    C. in an OR decision
  12. Which of the following is a poorly written, trivial Boolean expression?




    D. a < 10 AND a > 40
  13. Which of the following must always be false?




    D. e > 10 AND e < 7
  14. Which of the following must always be true?




    A. g <> 12 OR g <> 15
  15. 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
    endif
    endif
    endif




    C. MEDIUM_RAISE
  16. 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 then
    raise = BIG_RAISE
    endif
    endif
    endif




    C. impossible to tell
  17. When you use a range check, you always compare a variable to                   value in the range.




    B. an end-of-range value
  18. If sales = 100, rate = 0.10, and expenses = 50, which of the following expressions is true?




    D. two of the above
  19. If a is true, b is true, and c is false, which of the following expressions is true?




    D. two of the above
  20. If d is true, e is false, and f is false, which of the following expressions is true?




    C. d OR e AND f
Author
jdavis123
ID
357447
Card Set
Python Unit 4
Description
Updated