wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Logic and Design - Chapter 4 - Making Decisions

Total questions: 35

Worksheet time: 53mins

Name
Class
Date
1.

What is the fundamental nature of
Boolean expressions in computer programming?

a)

They can have multiple possible values.

b)

They evaluate to either true or false.

c)

They are based on complex mathematical functions.

d)

They always result in a numeric value.

2.

If a > b is false, then which of the following is always true?

a)

a <= b

b)

a < b

c)

a = b

d)

a >= b

3.

In the following pseudocode, what percentage

raise will an employee in Department 5 receive?

a)

SMALL_RAISE

b)

MEDIUM_RAISE

c)

BIG_RAISE

d)

impossible to tell

4.

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

5.

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

6.

Why is true/false evaluation natural for computers
when working with Boolean expressions?

a)

Because it simplifies programming.

b)

Due to the use of common algebraic symbols.

c)

Computers use two-state on-off switches.

d)

To allow for more complex decision-making.

7.

Which of the following structures involves the
use of Boolean expressions in computer programming?

a)

Loop structure

b)

Selection structure

c)

Sequence Structure

d)

Function structure

8.

Who is considered the founder of mathematical logic and
is the namesake of Boolean (true/false) expressions?

a)

Alan Turing

b)

George Boole

c)

John von Neumann

d)

Ada Lovelace

9.

In a dual-alternative selection, how are the two possible choices,

or outcomes, typically described?

a)

They are dependent on each other.

b)

They are unrelated and can both be executed.

c)

They are mutually exclusive.

d)

They are interchangeable.

10.

Which of the following best characterizes a

dual-alternative (binary) selection structure in a flowchart?

a)

It allows for multiple actions for the same outcome.

b)

It involves a diamond-shaped symbol.

c)

It always proceeds to both branches simultaneously.

d)

It does not involve any questions or decisions.

11.

In a single-alternative selection, what is the characteristic of the "else" branch?

a)

It is the primary branch that is always executed.

b)

It is an optional branch.

c)

It is executed if the question represented by the diamond is answered positively.

d)

It is not used in single-alternative selections.

12.

How many operands are required for each of the relational comparison operators?

a)

One operand

b)

Three operands

c)

Two operands

d)

Four operands

13.

What does the relational comparison operator "==" typically

represent in most programming languages?

a)

Greater than

b)

Less than or equal to

c)

Equal to

d)

Not equal to

14.

Which relational comparison operator is used to check if

one value is less than or equal to another value in programming?

a)

>

b)

<=

c)

==

d)

&&

15.

In a Boolean expression, what does the relational
comparison operator "!=" usually indicate?

a)

Greater than

b)

Less than or equal to

c)

Not equal to

d)

Equal to

16.

Which relational comparison operator is used to check

if one value is greater than another value in programming?

a)

<=

b)

>=

c)

!=

d)

>

17.

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?

a)

Greater than

b)

Equal

c)

Less than or equal

d)

Greater than or equal

18.

What is a common error associated with the use of relational operators in programming?

a)

Using too many relational operators in a single expression

b)

Using relational operators with non-numeric data types

c)

Using the wrong relational operator and missing the required boundary

d)

Not using relational operators in programming at all

19.

What is the recommended course of action to avoid misunderstandings

when using phrases like "over 65" in programming requirements?

a)

Assume that the phrase means "greater than" and use the ">" operator.

b)

Double-check the intended meaning with the person who requested the program.

c)

Ignore the phrase and use a standard operator for comparison.

20.

What is a compound condition in programming?

a)

A complex mathematical expression

b)

A decision based on a single question

c)

The combination of multiple selection structures

d)

When you ask multiple questions before an outcome is determined

21.

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?

a)

OR condition

b)

NOT condition

c)

AND condition

d)

XOR condition

22.

In an AND decision, what is the requirement for an action to take place?

a)

Only one condition must be true.

b)

Two conditions must be true.

c)

At least one condition must be true.

d)

Conditions are not relevant in an AND decision.

23.

What is the result of combining two Boolean expressions using the AND operator,

and what causes the entire expression to be evaluated as false?

a)

The result is always true, and it cannot be evaluated as false.

b)

The result is a single, longer expression.

c)

The entire expression is evaluated as false if either part of the expression is false.

d)

The entire expression is always evaluated as true.

24.

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?

a)

Logical evaluation

b)

Short-circuit evaluation

c)

Truth table analysis

d)

Nested evaluation

25.

What is an OR decision in programming?

a)

A decision where neither condition matters.

b)

A decision that combines multiple conditions using the AND operator.

c)

A decision where either one condition or some other condition must be true.

d)

A decision that requires both conditions to be true.

26.

In an OR decision, when is the entire expression evaluated as false?

a)

Only when both conditions are true.

b)

Only when one condition is true.

c)

Only when both conditions are false.

d)

The entire expression is never evaluated as false.

27.

When would you use the OR operator to combine Boolean expressions?

a)

To ensure that both expressions are always true.

b)

To check if both expressions are false.

c)

When you want an action to occur when either one of two conditions is met.

d)

When you want to combine multiple conditions into a single expression.

28.

What is the primary purpose of the logical NOT operator in programming?

a)

It combines two or more Boolean expressions.

b)

It requires both expressions to be true for an action to occur.

c)

It inverts the truth value of a Boolean expression.

d)

It speeds up the processing time of a program.

29.

What is the recommended strategy when dealing

with an OR decision for better program efficiency?

a)

Always ask the more complicated question first.

b)

Ask the question that is less likely to be true first.

c)

Randomly choose which question to ask first.

d)

It does not matter which question is asked first in an OR decision.

30.

What is the concept of making selections within ranges in programming?

a)

Selecting values within a specific data type.

b)

Choosing values randomly from a list.

c)

Making decisions based on the value falling within a specified range.

d)

Sorting values in ascending order.

31.

How are ranges typically defined when making selections within ranges?

a)

By specifying the maximum value only.

b)

By specifying the minimum value only.

c)

By defining both the minimum and maximum values.

d)

Ranges are not typically defined in programming.

32.

What is the primary purpose of the case structure in programming?

a)

To create loops for repetitive tasks.

b)

To execute code only if a specific condition is met.

c)

To allow the program to select from multiple alternatives based on a given value.

d)

To define data types and variables.

33.

How is the case structure different from a simple if-else statement?

a)

The case structure is used for mathematical calculations only.

b)

The case structure can have multiple alternatives, while an if-else statement has only two.

c)

The case structure cannot handle conditions.

d)

The case structure is less efficient than an if-else statement.

34.

What is common to every decision you make in a computer program?

a)

The use of complex data structures.

b)

The need for mathematical calculations.

c)

The evaluation of a Boolean expression.

d)

The requirement for random outcomes.

35.

When should you use if-then-else structures in programming?

a)

When no action is required.

b)

When action is required whether the selection is true or false.

c)

When there is only one possible outcome.

d)

When there are more than two possible outcomes.