CIS121 Programming and Logic Chapter 4
The Midwest Sales region of Acme Computer Company consists of five states - Illinois, Indiana, Iowa, Missouri, and Wisconsin. About 50 percent of the regional customers reside in Illinois, 20 percent in Indiana, and 10 percent in each of the other three states. Suppose you have input records containing Acme customer data, including state of residence. To most efficiently select and display all customers who live in the Midwest Sales region, you would ask first about residency in ______.
Any of the five states - it does not matter which one is first
In the following pseudocode, what percentage raise will an employee in Department 5 receive? if department < 3 then raise = SMALL_RAISE else if department < 5 then raise = MEDIUM_RAISE else raise = BIG_RAISE endif endif
BIG_RAISE
An expression like "amount < 10?" is a[n] ______ expression.
Boolean
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
MEDIUM_RAISE
What are the two alternatives for a selection(decision)?
Single and Dual
The Boffo Balloon Company makes helium balloons. Large balloons cost $13.00 a dozen, medium-sized balloons cost $11.00 a dozen, and small balloons cost $8.60 a dozen. About 60 percent of the company's sales are of the smallest balloons, 30 percent are medium, and large balloons constitute only 10 percent of sales. Customer order records include customer information, quantity ordered, and size. To write a program that makes the most efficient determination of an order's price based on size ordered, you should ask first whether the size is ______.
Small
If a > b is false, then which of the following is always true?
a <= b
All selection statements must have ______.
a THEN clause
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 Answer: d
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 Answer: c
Which variable is a true/false?
bool
The selection statement "if dayOfWeek = "Sunday" then price = LOWER_PRICE else price = HIGHER_PRICE is an example of a ______.
dual-alternative selection
If you could use only three relational comparison operators, you could get by with ______.
equal to, less than, and greater than
What is equivalent to the following decision? if x > 10 then if y > 10 then output "X" endif endif
if x > 10 AND y > 10 the output "X"
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
impossible to tell
When you use a range check, you compare a variable to the ______ value in the range.
lowest or highest
The Boffo Balloon Company makes helium balloons in three sizes, 12 colors, and with a choice of 40 imprinted sayings. As a promotion, the company is offering a 25 percent discount on orders of large, red balloons imprinted with the string "Happy Valentine's Day". To most efficiently select the orders to which a discount applies, you would use ______.
nested IF statements using AND logic
Usually, the most difficult comparison operator to work with is ______.
not equal to
Which variable can only store numbers?
num
Name the three types of variables
number string boolean
Symbols such as > and < are known as ______ operators.
relational comparison
The selection statement "if quantity > 100 then discountRate = RATE" is an example of a ______.
single-alternative selection
Which variable can store numbers or letters?
string
Usually, you compare only variables that have the same ______.
type