Programming Logic and Design: Chapter 3 Review Questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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 _____________. a. Illinois b. Indiana c. Either Iowa, Missouri, or Wisconsin--It does not matter which one of these three are first d. Any of the five states; it does not matter which one is first

a. Illinois

In the following pseudocode, what percentage raise will an employee in Department 3 receive? if department < 2 then raise = SMALL_RAISE endif if department < 6 then raise = MEDIUM_RAISE endif if department < 10 then raise = BIG_RAISE endif a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell

a. SMALL_RAISE

The selections statement if quantity > 100 then discoutRate = RATE is an example of a: a. Single-alternative selection b. Dual-alternative selection c. Binary selection d. All of the above

a. Single-alternative selection

Which of the following is true? a. The AND operator has higher precedence than the OR operator b. The OR operator has higher precedence than the AND operator c. The AND and OR operators have the same precedence d. The precedence of AND and OR operators depends on the programming language. c. BIG_RAISE d. impossible to tell

a. The AND operator has higher precedence than the OR operator

All selection statements must have ______ a. an if clause b. an else clause c. Both of the above d. None of the above

a. an if clause

An expression like amount < 10 is an___________expression. a. Gregorian b. Boolean c. Machiavellian d. Edwardian

b. Boolean

In the following pseudocode, what percentage raise will an employee in Department 8 receive? if department < 5 then raise = 100 else if department < 9 then raise = 250 else if department < 14 then raise = 375 endif endif endif a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell

b. MEDIUM_RAISE

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

b. a <= b

If you could use only three relational comparison operators, you could get by with _____________. a. greater than, less than, and greater than or equal to b. less than, less than or equal to, and not equal to c. equal to, less than, and greater than d. equal to, not equal to, and less than

b. less than, less than or equal to, and not equal to

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 "Happy Valentine's Day" balloons. To most efficiently select the orders to which a discount applies, you would use _____________. a. three completely separate unnested if statements b. nested if statements using AND logic c. nested if statements using OR logic d. Not enough information is given.

b. nested if statements using AND logic

Symbols like > and < are known as _____________ operators. a. arithmetic b. relational comparison c. sequential d. scripting accuracy

b. relational comparison

In the following pseudocode, what percentage raise will an employee in Department 5 receive? if department < 3 then raise = 25 else if department < 5 then raise = 50 else raise = 75 endif endif a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell

c. BIG_RAISE

The selection statement if dayOfWeek = "Sunday" then price = LOWER_PRICE else price = HIGHER_PRICE is an example of a ______ a. Unary selection b. Single-alternative selection c. Dual-alternative selection d. All of the above

c. Dual-alternative selection

The Acme Computer Company operates in all 50 of the United States. The Midwest Sales region consists of five states--Illinois, Indiana, Iowa, Missouri, and Wisconsin. Suppose that 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 use ___________. a. five completely separate unnested if statements b. nested if statements using AND logic c. nested if statements using OR logic d.Not enough information is given.

c. nested if statements using OR logic

The Boffo Balloon Company makes helium balloons. Large balloons cost $13 a dozen, medium-sized balloons cost $11 a dozen, and small balloons cost $8.60 a dozen. About 60 percent of the company's sales are the smallest balloons, 30 percent are the medium, and large balloons constitute only 10 percent of sales. Customer order records include customer information, quantity ordered, and size. When you write a program to determine price based on size, for the most efficient decision, you should ask first whether the size is _____________. a. large b. medium c. small d. It does not matter.

c. small

The comparison operator that tends to cause the most logical errors is: a. Equal to b. Greater than c. Less than d. Not equal to

d. Not equal to

Radio station FM-99 keeps a record of every song played on the air in a week. Each record contains the day, hour, and minute the song started, and the title and artist of the song. The station manager wants a list of every title played during the important 8 a.m. commute hour on the two busiest traffic days, Monday and Friday. Which logic would select the correct titles? a. if day = "Monday" OR day = "Friday" OR hour = 8 then print title endif b. if day = "Monday" then if hour = 8 then print title else if day = "Friday" then print title endif endif endif c. if hour = 8 AND day = "Monday" OR day = "Friday" then print title endif d. if hour = 8 then if day = "Monday" OR day = "Friday" then print title endif endif

d. if hour = 8 then if day = "Monday" OR day = "Friday" then print title endif endif

In the following pseudocode, what percentage raise will an employee in Department 10 receive? if department < 2 then raise = 1000 else if department < 6 then raise = 2500 else if department < 10 then raise = 3000 endif endif endif a. SMALL_RAISE b. MEDIUM_RAISE c. BIG_RAISE d. impossible to tell

d. impossible to tell

Usually, you compare only variables that have the same _____________. a. value b. size c. name d. type

d. type

Which of the lettered choices is equivalent to the following decision? if x > 10 then if y > 10 then print "X" endif endif a. if x > 10 AND y > 10 then print "X" b. if x > 10 OR y > 10 then print "X" c. if x > 10 AND x > y then print "X" d.if y > x then print "X"

if x > 10 then


Set pelajaran terkait

Bible 105 Final Exam Study Guide

View Set

Chapter 1 Vocab and Consepts from power point

View Set

CIS2336 - CH3: Introduction to HTMl

View Set

Organizational Behavior & Management - Chapter 3

View Set

LSD and Psilocybin (magic mushrooms)

View Set

STRUCTURE OF MATTER I TEST REVIEW

View Set

CFA Level 1 - Ethics, Professional Standards, and GIPS

View Set