Programming Logic and Design - Chapter 1,2,3,4,5 Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Typically, the value added to a counter variable is _____.

1

1. What does a declaration provide for a variable

1. Name & data type

2. A variable's data type describes all of the following except _______?

2. The scope of the variable

3. The value stored in an uninitialized variable is ______?

3. Garbage

4. The value 3 is a ______.

4. Numeric constant

5. The assignment operator _____.

5. is a binary operator

What is the name for the process of paying attention to important properties while ignoring nonessential details?

Abstraction

Which of the following is true of structured logic?

Any task can be described using some combination of the three structures.

What are nonexecuting statements that programmers place within code to explain program statements in English?

Comments

Which of the following is true about arithmetic precedence?

Division has higher precedence than subtraction

Which is true of stacking structure?

Each structure has only one point where it can be stacked on top of another.

Are programmers comments required to create a runnable program or a form of external documentation? (T/F)

False

Printing summaries is a typical housekeeping task. (T/F)

False

Which of the following is NOT a benefit of modularizing programs?

If you use modules, you can ignore the rules of structure.

Every module has all of the following except ________?

Local variable

Which of the following is NOT another term for a selection structure?

Loop structure

The following are terms used as a synonym for module in some programming languages.

Method & procedure

Why use modularization?

Modularization allows you to more easily reuse your work

Which of the following is acceptable in a structured programming?

Placing a sequence with the true half of a dual-alternative decision Placing decision within a loop Placing a loop within one of the steps in a sequence

A message that asks a user for input is a ______.

Prompt

The three structures of structured programming are ______________.

Sequence, Selection, and Loop

Which of the following is not a step that must occur with every correctly working loop?

Set the loop control value equal to a sentinel during each iteration.

Which of the following is NOT a reason for enforcing structure rules in a computer programs?

Structured programs usually are shorter than unstructured ones.

Which of the following attributes do all three basic structures share?

They all have one entry and one exit point.

What is valid advice for naming variables?

To make names easier to read, separate long names by using underscores or capitalization for each new word.

The detail loop in a typical program will execute the most. (T/F)

True

Which of the following is a definite loop?

a loop that executes 1000 times

Which of the following is an indefinite loop?

a loop that follows a prompt that asks a user how many repetitions to make and uses the value to control the loop

The Midwest Sales region of Acme Computer Company consists of fi ve 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

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

a. a <= b

If a is true, b is true, and c is false, which of the following expressions is true?

a. a OR b AND c b. a AND b AND c d. two of the above C. a AND b OR c

All selection statements must have ______

a. a then clause

Th e selection statement if dayOfWeek = "Sunday" then price = LOWER_PRICE else price = HIGHER_PRICE is an example of a ______

a. dual-alternative selection

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 d. two of the above C. d OR e AND f

The two most commonly used tools for planning a program's logic are ______

a. flowcharts and pseudocode

Which of the following is an example of a logical error?

a. performing arithmetic with a value before inputting it b. accepting two input values when a program requires only one c. dividing by 3 when you meant to divide by 30 d. ALL OF THE ABOVE

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

A programming language's rules are its ______

a. syntax

As compared to procedural programming, with objectoriented programming ______

a. the programmer's focus differs

Usually, you compare only variables that have the same ______

a. type

A sequence structure can contain __________.

any number of tasks

When a loop executes, the structure-controlling question is _____________.

asked either before or after the loop body executes

In a selection structure, the structure-controlling question is _______________.

asked once at the beginning of the structure.

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 raise = BIG_RAISE endif endif endif

b. MEDIUM_RAISE

The term "eof" represents ______

b. a generic sentinel value

Writing a program in a language such as C++ or Java is known as ______ the program.

b. coding

If you could use only three relational comparison operators, you could get by with ______

b. equal to, less than, and greater than

The major computer operations include ______

b. input, processing, and output

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 off ering 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 ______

b. nested if statements using AND logic

The selection statement if quantity > 100 then discountRate = RATE is an example of a ______

b. single-alternative selection

Computer programs are also known as ______

b. software

When you write a program that will run in a GUI environment as opposed to a command-line environment, ______

b. some syntax is different

A group of statements that executes as a unit is a __________.

block

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

c. BIG_RAISE

The parallelogram is the flowchart symbol representing ______

c. both a and b

An English-like programming language such as Java or Visual Basic is a ______ programming level

c. high-level

Which of the following is an example of a syntax error?

c. misspelling a programming language word

Symbols such as > and < are known as ______ operators

c. relational comparison

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 effi cient determination of an order's price based on size ordered, you should ask first whether the size is ______

c. small

The most important task of a compiler or inerpreter is to ______

c. translate programming language statements into machine language

Programmers say that one module can ______ another, meaning that the first module causes the second module to execute.

call

An expression like amount < 10 is a(n) ______ expression

d. Boolean

Which of the following pairs of steps in the programming process is in the correct order?

d. code the program, translate it into machine language

In flowcharts, the decision symbol is a ______

d. diamond

Which of the lettered choices is equivalent to the following decision? if x > 10 then if y > 10 then output "X" endif endif

d. if x > 10 AND y > 10 then 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 raise = BIG_RAISE endif endif endif

d. impossible to tell

When you use a range check, you compare a variable to the ______ value in the range

d. lowest or highest

Which of the following is temporary, internal storage?

d. memory

Usually, the most diffi cult comparison operator to work with is ______

d. not equal to

In a flowchart, a rectangle represents ______

d. processing

Visual Basic, C++, and Java are all examples of computer ______

d. programming languages

When you use an IDE instead of a simple text editor to develop a program,______

d. some help is provided

The programmer's most important task before planning the logic of a program is to ______

d. understand the problem

Typically, the value added to an accumulator variable is _____.

different in each iteration

The statement 'if age < 13 then movieTicket = 4.00 else movieTicket = 8.50' is an example of __________.

dual-alternation selection

Overriding a user's entered value by setting it to a predetermined value is known as ______.

forcing

The more that a module's statements contribute to the job, the greater the ________ of the module.

functional cohesion

The structure in which you ask a question, and, depending on the answer, take some action and then ask the question again, can be called all of the following except a(n) _________.

if-else-then

In most modern programming languages, a variable or constant that is declared in a module is _______ in that module.

in scope

Adding 1 to a variable is also called _____ it.

incrementing

When two loops are nested, the loop that is contained by the other is the _____ loop.

inner

The statement 'while temperature remains below 60, leave the furnace on' is an example of a ____________.

loop

The structure that allows you to write one set of instructions that operates on multiple, separate sets of data is the _____.

loop

The statements executed within a loop are known collectively as the _____.

loop body

Placing a structure within another structure is called ________ the structures.

nesting

After an accumulator or counter variable is displayed at the end of a program, it is best to _____.

none of the above

When loops are nested, _____.

none of the above

When you input data in a loop within a program, the input statement that precedes the loop is called a(n) ___________.

priming input

The statement 'if age > = 65 then seniorDiscount = "yes"' is an example of a ____________.

single-alternative selection

Snarled program logic is called _______ code.

spaghetti

Attaching structures end to end is called _________.

stacking

When you decrement a variable, you _____.

subtract a value from it

13. A report that lists only totals, with no details about individual records, is a(n) _____ report.

summary

A variable might hold an incorrect value even when it is _____.

the correct data type, within a required range, a constant coded by the programmer all of the above

A counter keeps track of _____.

the number of times an event has occurred

To ensure that a user's entry is the correct data type, frequently you ______.

use a method built into the programming language

When you _____, you make sure data items are the correct type and fall within the correct range.

validate data

Most programmers use a for loop _____.

when they know the exact number of times a loop will repeat

A hierarchy chart tells you ______.

which routines call which other routines.

The loop that frequently appears in a program's mainline logic _____.

works correctly based on the same logic as other loops


Conjuntos de estudio relacionados

Lab Simulation 8-1: MAC Address Filtering

View Set

EAQ Sedatives, Hypnotics and Anxiety

View Set

Chapter 29 Multiple Choice Questions

View Set