Chapter 4 Practice Quiz

docx

School

Ivy Tech Community College, Indianapolis *

*We aren’t endorsed by this school

Course

120

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

4

Uploaded by MasterBaboon3951

Report
Chapter 4 Practice Quiz 1. A expression has one of two values: true or false. a. Georgian b. Boolean c. Barbarian d. Selective 2. In a selection, the else clause executes . a. only after the if clause executes b. when the tested condition is true c. when the tested condition is false d. always 3. The greater-than operator evaluates as true when . a. the right operand is greater than the left operand b. the left operand is greater than the right operand c. the right operand is equal to the left operand d. Both b and c are true. 4. A trivial Boolean expression is one that . a. is uses only two operands b. always has the same value c. is always true d. is always false 5. 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 6. 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. 7. In an AND condition, the most efficient technique is to first ask the question that . a. is most likely to be true b. is least likely to be true c. that contains the most operands d. uses a named constant
8. If a is true and b is false, then . a. a AND b is true b. a AND b is false c. a OR b is false d. If a is true, then b must be true. 9. 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 10. Which of the lettered choices is equivalent to the following decision? 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 11. 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 12. Which of the following is a poorly written, trivial Boolean expression? a. a > b AND b > c b. a = 100 OR b > 200 c. a < b AND c < 100 AND d <> 5 d. a < 10 AND a > 40 13. Which of the following must always be false? a. e > 12 AND e < 15 b. e = 10 OR e = 20 c. e > 12 OR f > 12 d. e > 10 AND e < 7
14. Which of the following must always be true? a. g < 12 AND g < 18 b. g = 12 OR h = 17 c. g <> 12 OR g <> 15 d. g > 12 AND g < 21 15. In the following pseudocode, what percentage raise will an employee in Department 8 receive? a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell 16. In the following pseudocode, what percentage raise will an employee in Department 10 receive? a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
17. When you use a range check, you always compare a variable to value in the range. a. the lowest b. the highest c. an end-of-range value d. the average 18. 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 19. 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 20. 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 c. d OR e AND f d. two of the above