Font size
WorksheetsProgramming Logic and Design - Chapter 4 - Making Decisions
Total questions: 35
Worksheet time: 53mins
What is the fundamental nature of
Boolean expressions in computer programming?
They can have multiple possible values.
They evaluate to either true or false.
They are based on complex mathematical functions.
They always result in a numeric value.
If a > b is false, then which of the following is always true?
a <= b
a < b
a = b
a >= b
In the following pseudocode, what percentage
raise will an employee in Department 5 receive?
SMALL_RAISE
MEDIUM_RAISE
BIG_RAISE
impossible to tell
In the following pseudocode, what percentage raise
will an employee in Department 8 receive?
SMALL_RAISE
MEDIUM_RAISE
BIG_RAISE
impossible to tell
If sales = 100, rate = 0.10, and expenses = 50,
which of the following expressions is true?
sales >= expenses AND rate < 1
sales < 200 OR expenses < 100
expenses = rate OR sales = rate
Why is true/false evaluation natural for computers
when working with Boolean expressions?
Because it simplifies programming.
Due to the use of common algebraic symbols.
Computers use two-state on-off switches.
To allow for more complex decision-making.
Which of the following structures involves the
use of Boolean expressions in computer programming?
Loop structure
Selection structure
Sequence Structure
Function structure
Who is considered the founder of mathematical logic and
is the namesake of Boolean (true/false) expressions?
Alan Turing
George Boole
John von Neumann
Ada Lovelace
In a dual-alternative selection, how are the two possible choices,
or outcomes, typically described?
They are dependent on each other.
They are unrelated and can both be executed.
They are mutually exclusive.
They are interchangeable.
Which of the following best characterizes a
dual-alternative (binary) selection structure in a flowchart?
It allows for multiple actions for the same outcome.
It involves a diamond-shaped symbol.
It always proceeds to both branches simultaneously.
It does not involve any questions or decisions.
In a single-alternative selection, what is the characteristic of the "else" branch?
It is the primary branch that is always executed.
It is an optional branch.
It is executed if the question represented by the diamond is answered positively.
It is not used in single-alternative selections.
How many operands are required for each of the relational comparison operators?
One operand
Three operands
Two operands
Four operands
What does the relational comparison operator "==" typically
represent in most programming languages?
Greater than
Less than or equal to
Equal to
Not equal to
Which relational comparison operator is used to check if
one value is less than or equal to another value in programming?
>
<=
==
&&
In a Boolean expression, what does the relational
comparison operator "!=" usually indicate?
Greater than
Less than or equal to
Not equal to
Equal to
Which relational comparison operator is used to check
if one value is greater than another value in programming?
<=
>=
!=
>
Suppose you want to offer a 10 percent discount to any customer aged 65 or older.
Which comparison operator would be most suitable for expressing this logic?
Greater than
Equal
Less than or equal
Greater than or equal
What is a common error associated with the use of relational operators in programming?
Using too many relational operators in a single expression
Using relational operators with non-numeric data types
Using the wrong relational operator and missing the required boundary
Not using relational operators in programming at all
What is the recommended course of action to avoid misunderstandings
when using phrases like "over 65" in programming requirements?
Assume that the phrase means "greater than" and use the ">" operator.
Double-check the intended meaning with the person who requested the program.
Ignore the phrase and use a standard operator for comparison.
What is a compound condition in programming?
A complex mathematical expression
A decision based on a single question
The combination of multiple selection structures
When you ask multiple questions before an outcome is determined
In the example provided about a cell phone billing program, what is the condition that requires both a minimum number of calls and a minimum number of minutes to be true for an additional charge?
OR condition
NOT condition
AND condition
XOR condition
In an AND decision, what is the requirement for an action to take place?
Only one condition must be true.
Two conditions must be true.
At least one condition must be true.
Conditions are not relevant in an AND decision.
What is the result of combining two Boolean expressions using the AND operator,
and what causes the entire expression to be evaluated as false?
The result is always true, and it cannot be evaluated as false.
The result is a single, longer expression.
The entire expression is evaluated as false if either part of the expression is false.
The entire expression is always evaluated as true.
What is the term for the feature where each part of an expression that uses an AND operator is evaluated only as far as necessary to determine whether the entire expression is true or false?
Logical evaluation
Short-circuit evaluation
Truth table analysis
Nested evaluation
What is an OR decision in programming?
A decision where neither condition matters.
A decision that combines multiple conditions using the AND operator.
A decision where either one condition or some other condition must be true.
A decision that requires both conditions to be true.
In an OR decision, when is the entire expression evaluated as false?
Only when both conditions are true.
Only when one condition is true.
Only when both conditions are false.
The entire expression is never evaluated as false.
When would you use the OR operator to combine Boolean expressions?
To ensure that both expressions are always true.
To check if both expressions are false.
When you want an action to occur when either one of two conditions is met.
When you want to combine multiple conditions into a single expression.
What is the primary purpose of the logical NOT operator in programming?
It combines two or more Boolean expressions.
It requires both expressions to be true for an action to occur.
It inverts the truth value of a Boolean expression.
It speeds up the processing time of a program.
What is the recommended strategy when dealing
with an OR decision for better program efficiency?
Always ask the more complicated question first.
Ask the question that is less likely to be true first.
Randomly choose which question to ask first.
It does not matter which question is asked first in an OR decision.
What is the concept of making selections within ranges in programming?
Selecting values within a specific data type.
Choosing values randomly from a list.
Making decisions based on the value falling within a specified range.
Sorting values in ascending order.
How are ranges typically defined when making selections within ranges?
By specifying the maximum value only.
By specifying the minimum value only.
By defining both the minimum and maximum values.
Ranges are not typically defined in programming.
What is the primary purpose of the case structure in programming?
To create loops for repetitive tasks.
To execute code only if a specific condition is met.
To allow the program to select from multiple alternatives based on a given value.
To define data types and variables.
How is the case structure different from a simple if-else statement?
The case structure is used for mathematical calculations only.
The case structure can have multiple alternatives, while an if-else statement has only two.
The case structure cannot handle conditions.
The case structure is less efficient than an if-else statement.
What is common to every decision you make in a computer program?
The use of complex data structures.
The need for mathematical calculations.
The evaluation of a Boolean expression.
The requirement for random outcomes.
When should you use if-then-else structures in programming?
When no action is required.
When action is required whether the selection is true or false.
When there is only one possible outcome.
When there are more than two possible outcomes.
