Chapter 4-Making Decisions-Every decision you make in a computer

| August 31, 2017

Question
Chapter 4: Making Decisions

TRUE/FALSE

1. Every decision you make in a computer program involves evaluating a Boolean expression.

2. When you need to satisfy two or more criteria to initiate an event in a program, you must make sure that the second decision is made entirely independently of the first decision.

3. Most programming languages allow you to ask two or more questions in a single comparison.

4. When you combine AND and OR operators, the OR operators take precedence, meaning their Boolean values are evaluated first.

5. You can use parentheses to override the default order of operations.

MULTIPLE CHOICE

1. A selection with an action that is associated with each of two possible outcomes is known as a(n) ____ selection.

a. unary c. octal

b. binary d. semiconductor

2. The keyword that is NOT included in a single-alternative selection is ____.

a. if c. else

b. then d. endif

3. Boolean expressions are named after ____.

a. Harold Boolean c. George Boole

b. Henry Boole d. Gerhardt Boolean

4. ____ operators require two operands.

a. Unary c. Binary

b. Tertiary d. Double

5. In most programming languages, the ____ sign means “greater than.”

a. < c.

6. Usually, ____ variables are not considered to be equal unless they are identical.

a. string c. character

b. integers d. floating point

7. When you ask multiple questions before an outcome is determined, you create a ____ condition.

a. dual-alternative c. single-alternative

b. nested d. compound

8. A(n) ____ decision is a decision in which two conditions must be true for an action to take place.

a. OR c. AND

b. XOR d. OR-ELSE

9. A series of nested if statements is also called a ____ statement.

a. n-alternative if c. case

b. cascading if d. loop

10. A series of nested if statements is also called a ____ if statement.

a. stacked c. bonded

b. cascading d. hooked

11. Most languages allow you to use a variation of the decision structure called the ____ structure when you must nest a series of decisions about a single variable.

a. blocked c. AND IF

b. case d. logical

12. Most programming languages allow you to ask two or more questions in a single comparison by using an ____ operator that joins decisions in a single statement.

a. AND c. IF

b. OR d. XOR

13. When creating a truth table, you must determine how many possible Boolean value combinations exist for the conditions. If there are two conditions, ____ combinations will exist.

a. 2 c. 8

b. 4 d. 16

14. In a truth table, the expression ____ is true.

a. true AND true c. false AND true

b. true AND false d. false AND false

15. The conditional AND operator in Java, C++, and C# is ____.

a. & c. **

b. AND d. &&

16. ____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.

a. Decision matrices c. Truth diagrams

b. Decision diagrams d. Truth tables

17. For maximum efficiency, a good rule of thumb in an OR decision is to ____.

a. first ask the question that is more likely to be true

b. first ask the question that is more likely to be false

c. rewrite as an AND decision and ask the question more likely to be true

d. rewrite as an AND decision and ask the question more likely to be false

18. C#, C++, C, and Java use the symbol ____ as the logical OR operator.

a. % c. ||

b. $ d. ^

19. You use the logical ____ operator to reverse the meaning of a Boolean expression.

a. AND c. OR

b. XOR d. NOT

20. The logical AND operator can be compared to ____ in terms of precedence.

a. addition c. multiplication

b. subtraction d. division

21. The logical OR operator can be compared to ____ in terms of precedence.

a. addition c. multiplication

b. subtraction d. division

COMPLETION

1. A dual-alternative, or ____________________, selection is one in which an action is associated with each of two possible outcomes.

2. The ____________________ clause of the decision is the part of the decision that holds the action or actions that execute when the tested condition in the decision is true.

3. When you ____________________ decisions because the resulting action requires that two conditions be true, you must decide which of the two decisions to make first.

4. In an AND decision, first ask the question that is less likely to be ____________________.

5. When you use a(n) ____________________ check, you compare a variable to a series of values that mark the limiting ends of ranges.

MATCHING

Match each item with a statement below.

a. nested decision f. logical OR

b. case structure g. else clause

c. AND h. dead

d. binary selection i. trivial expressions

e. Boolean expression

1. if-then-else structure

2. An expression whose value can be only true or false

3. Part of a decision that executes only when the tested condition in the decision is false

4. Will always evaluate to the same result

5. Path that can never be traveled

6. A decision “inside of” another decision

7. Used when you must nest a series of decisions about a single variable

8. Using this operator, each Boolean expression must be true in order for the entire expression to be evaluated as true

9. When this operator is used, only one of the listed conditions must be met for the resulting action to take place

SHORT ANSWER

1. Describe a Boolean expression.

2. Who was George Boole and what did he do?

3. List the three types of comparisons that enable the making of any decision.

4. When would you use a negative comparison?

5. How can you improve the efficiency of a nested decision?

6. Explain the purpose and use of the AND operator.

7. In an OR decision, why is it more efficient to first ask the question that is more likely to be true?

8. Explain what a range check is and provide an example.

9. When you combine AND and OR operators within the same statement, which takes precedence?

10. List three techniques to avoid confusio

Get a 30 % discount on an order above $ 100
Use the following coupon code:
RESEARCH
Order your essay today and save 30% with the discount code: RESEARCHOrder Now
Positive SSL