Programming Logic & Design, Comprehensive 9e Joyce Farrell - Test Bank

Programming Logic & Design, Comprehensive 9e Joyce Farrell - Test Bank   Instant Download - Complete Test Bank With Answers     Sample Questions Are Posted Below   True / False   1. The loop control variable is initialized after entering the loop.   a. True   b. False   ANSWER:   False POINTS:   1 REFERENCES:   179 …

$19.99

Programming Logic & Design, Comprehensive 9e Joyce Farrell – Test Bank

 

Instant Download – Complete Test Bank With Answers

 

 

Sample Questions Are Posted Below

 

True / False

 

1. The loop control variable is initialized after entering the loop.

  a. True
  b. False

 

ANSWER:   False
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

2. In some cases, a loop control variable does not have to be initialized.

  a. True
  b. False

 

ANSWER:   False
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

3. You can either increment or decrement the loop control variable.

  a. True
  b. False

 

ANSWER:   True
POINTS:   1
REFERENCES:   181
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

4. An indefinite loop is a loop that never stops.

  a. True
  b. False

 

ANSWER:   False
POINTS:   1
REFERENCES:   181
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

5. When one loop appears inside another is is called an indented loop.

  a. True
  b. False

 

ANSWER:   False
POINTS:   1
REFERENCES:   185
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

6. Forgetting to initialize and alter the loop control variable are common mistakes that programmers sometimes make.

  a. True
  b. False

 

ANSWER:   True
POINTS:   1
REFERENCES:   190
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

7. Every high-level computer programming language contains a while statement.

  a. True
  b. False

 

ANSWER:   True
POINTS:   1
REFERENCES:   199
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/15/2016 4:37 PM

 

8. Both the while loop and the for loop are examples of pretest loops.

  a. True
  b. False

 

ANSWER:   True
POINTS:   1
REFERENCES:   201
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

9. The safest action is to assign the value 1 to accumulators before using them.

  a. True
  b. False

 

ANSWER:   False
POINTS:   1
REFERENCES:   206
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

10. It is the programmer’s responsibility to initialize all variables that must start with a specific value.

  a. True
  b. False

 

ANSWER:   True
POINTS:   1
REFERENCES:   208
QUESTION TYPE:   True / False
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

Multiple Choice

 

11. The first step in a while loop is typically to ____.

  a. compare the loop control variable to a constant value
  b. initialize the loop control variable
  c. increment the loop control variable
  d. execute the body of the loop

 

ANSWER:   b
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

12. Once your logic enters the body of a structured loop, ____.

  a. the entire loop must execute
  b. the loop can be terminated with a break statement
  c. the loop will execute indefinitely
  d. a decision statement will be evaluated

 

ANSWER:   a
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

13. Use a counter or a(n) ____ to control a loop’s repetitions.

  a. sentinel variable
  b. end value
  c. sentinel value
  d. end statement

 

ANSWER:   c
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

14. A(n) ____ loop executes a predetermined number of times.

  a. terminal b. definite
  c. indefinite d. infinite

 

ANSWER:   b
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

15. Many loop control variable values are altered by ____, or adding to them.

  a. incrementing b. decrementing
  c. accumulating d. deprecating

 

ANSWER:   a
POINTS:   1
REFERENCES:   181
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

16. A(n) ____ is any numeric variable you use to count the number of times an event has occurred.

  a. accumulator b. key
  c. index d. counter

 

ANSWER:   d
POINTS:   1
REFERENCES:   181
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

17. A loop within another loop is known as a(n) ____ loop.

  a. indefinite b. infinite
  c. nested d. hidden

 

ANSWER:   c
POINTS:   1
REFERENCES:   185
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

18. When one loop appears inside another, the loop that contains the other loop is called the ____ loop.

  a. indefinite b. definite
  c. inner d. outer

 

ANSWER:   d
POINTS:   1
REFERENCES:   185
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

19. Usually, when you create nested loops, each loop has its own ____.

  a. sentinel value b. goto statement
  c. entrance condition d. loop control variable

 

ANSWER:   d
POINTS:   1
REFERENCES:   185
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

20. A mistake programmers often make with loops is that they ____.

  a. initialize the loop control variable prior to entering the loop body
  b. increment the loop control variable inside of the loop body
  c. include statements inside the loop that belong outside the loop
  d. enclose the inner loop entirely within the outer loop in a nested loop

 

ANSWER:   c
POINTS:   1
REFERENCES:   190
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

21. A mistake programmers often make with loops is that they ____.

  a. neglect to initialize the loop control variable prior to entering the loop body
  b. increment the loop control variable inside of the loop body
  c. validate data to ensure values are the correct data type or that they fall within an acceptable range
  d. enclose the inner loop entirely within the outer loop in a nested loop

 

ANSWER:   a
POINTS:   1
REFERENCES:   190
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

22. A comparison is correct only when the correct ____ and operator are used.

  a. expression b. operands
  c. statements d. index

 

ANSWER:   b
POINTS:   1
REFERENCES:   192
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

23. Programmers use the term ____ to describe programs that are well designed and easy to understand and maintain.

  a. industrial b. intractable
  c. well behaved d. elegant

 

ANSWER:   d
POINTS:   1
REFERENCES:   196
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

24. You usually use the for loop with ____ loops.

  a. indefinite b. definite
  c. inner d. outer

 

ANSWER:   b
POINTS:   1
REFERENCES:   199
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

25. The ____ loop provides three actions in one compact statement.

  a. for b. while
  c. do until d. repeat

 

ANSWER:   a
POINTS:   1
REFERENCES:   199
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

26. The amount by which a for loop control variable changes is often called a ____ value.

  a. group b. key
  c. step d. sentinel

 

ANSWER:   c
POINTS:   1
REFERENCES:   199
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

27. The ____ loop is particularly useful when processing arrays.

  a. for b. while
  c. infinite d. nested

 

ANSWER:   a
POINTS:   1
REFERENCES:   200
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

28. In a ____, the loop body might never execute because the question controlling the loop might be false the first time it is asked.

  a. summary report b. pretest loop
  c. posttest loop d. loop control

 

ANSWER:   b
POINTS:   1
REFERENCES:   201
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

29. In a ____, the loop body executes at least one time because the loop control variable is not tested until after one iteration.

  a. nested loop b. pretest loop
  c. posttest loop d. loop control

 

ANSWER:   c
POINTS:   1
REFERENCES:   201
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

30. A(n) ____ is very similar to a counter that you use to count loop iterations, except that you usually add a value other than one to this type of variable.

  a. transaction b. total
  c. validator d. accumulator

 

ANSWER:   d
POINTS:   1
REFERENCES:   205
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

31. Business reports that list only totals, with no individual item details, are called ____.

  a. detail reports b. summary reports
  c. transaction reports d. control-break reports

 

ANSWER:   b
POINTS:   1
REFERENCES:   208
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

32. ____ is a technique with which you try to prepare for all possible errors before they occur.

  a. Incrementing b. Stub
  c. Nested loop d. Defensive programming

 

ANSWER:   d
POINTS:   1
REFERENCES:   209
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

33. Loops are frequently used to ____; that is, to make sure it is meaningful and useful.

  a. validate data b. restructure data
  c. simulate data d. corroborate data

 

ANSWER:   a
POINTS:   1
REFERENCES:   209
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

34. Programmers employ the acronym ____ to mean that if your input is incorrect, your output is worthless.

  a. IBOW b. GIGO
  c. IIOW d. GIGS

 

ANSWER:   b
POINTS:   1
REFERENCES:   209
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

35. ____ a data item means you override incorrect data by setting the variable to a specific value.

  a. Flexing b. Tracing
  c. Forcing d. Blanking

 

ANSWER:   c
POINTS:   1
REFERENCES:   211
QUESTION TYPE:   Multiple Choice
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

Completion

 

36. To add to a variable is to ____________________ the variable.

ANSWER:   increment
POINTS:   1
REFERENCES:   181
QUESTION TYPE:   Completion
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/16/2016 5:21 PM

 

37. A posttest loop is sometimes called a ____________________ loop.

ANSWER:   do-while

do while

POINTS:   1
REFERENCES:   201
QUESTION TYPE:   Completion
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/16/2016 5:26 PM

 

38. In a for statement, a loop control variable is initialized, tested, and ____________________.

ANSWER:   altered
changed
incremented
decremented
POINTS:   1
REFERENCES:   199
QUESTION TYPE:   Completion
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

39. ____________________ are frequently used to accumulate totals and to validate data.

ANSWER:   Loops
loops
POINTS:   1
REFERENCES:   205
QUESTION TYPE:   Completion
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

40. ____________________ can ensure that a value is the correct data type or that it falls within an acceptable range.

ANSWER:   validation

Validation

POINTS:   1
REFERENCES:   209
QUESTION TYPE:   Completion
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

Matching

 

Match each term with a statement below.

a. indefinite
b. loop control variable
c. nested loops
d. counter
e. increment
f. decrement
g. accumulator
h. loop
i. step value
j. forcing

 

REFERENCES:   177
179
181
185
199
205
211
QUESTION TYPE:   Matching
HAS VARIABLES:   False
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

41. One set of instructions that operates on multiple, separate sets of data

ANSWER:   h
POINTS:   1

 

42. Initialized before entering a while loop

ANSWER:   b
POINTS:   1

 

43. To add to a variable

ANSWER:   e
POINTS:   1

 

44. To decrease a variable’s value

ANSWER:   f
POINTS:   1

 

45. Any numeric variable you use to count the number of times an event has occurred

ANSWER:   d
POINTS:   1

 

46. A loop that may execute a different number of times each time the program executes

ANSWER:   a
POINTS:   1

 

47. The amount by which a for loop control variable changes

ANSWER:   i
POINTS:   1

 

48. Loops within loops

ANSWER:   c
POINTS:   1

 

49. To override incorrect data by setting the variable to a specific, predetermined value

ANSWER:   j
POINTS:   1

 

50. A variable that you use to gather values

ANSWER:   g
POINTS:   1

 

Subjective Short Answer

 

51. What is an advantage of using fewer instructions?

ANSWER:   Using fewer instructions results in less time required for design and coding, fewer errors, and shorter compile time.
POINTS:   1
REFERENCES:   177
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

52. What are the three steps that should occur in every loop?

ANSWER:   1. The loop control variable is initialized before entering the loop.
2. The loop control variable is tested, and, if the result is true, the loop body is entered.
3. The loop control variable is altered within the body of the loop so that the while
expression eventually evaluates as false.
POINTS:   1
REFERENCES:   179
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

53. What is the difference between a definite loop and an indefinite loop?

ANSWER:   A definite loop executes a definite, predetermined number of times. An indefinite loop is indefinite because each time the program executes, the loop might be performed a different number of times.
POINTS:   1
REFERENCES:   179-181
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

54. Explain when it would be appropriate to write an indefinite loop.

ANSWER:   Often, the value of a loop control variable is not altered by arithmetic, but instead is altered by user input. For example, perhaps you want to continue performing some task while the user indicates a desire to continue. In that case, you do not know when you write the program whether the loop will be executed two times, 200 times, or not at all. This type of loop is an indefinite loop.
POINTS:   1
REFERENCES:   181
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

55. What are common mistakes made by programmers in coding loops?

ANSWER:   • Failing to initialize the loop control variable

• Neglecting to alter the loop control variable

• Using the wrong comparison with the loop control variable

• Including statements inside the loop that belong outside the loop

POINTS:   1
REFERENCES:   190
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/16/2016 5:36 PM

 

56. What is a step value?

ANSWER:   The amount by which a for loop control variable changes is often called a step value. The step value can be positive or negative; that is, it can increment or decrement.
POINTS:   1
REFERENCES:   199
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

57. What are the tasks performed by the for count = 0 to 3 statement?

ANSWER:   This for statement accomplishes several tasks:

  • The variable count is initialized to 0.
  • The count variable is compared to the limit value 3; while count is less than or equal to 3, the loop body executes.
  • As the last statement in the loop execution, the value of count increases by 1. After the increase, the comparison to the limit value is made again.
POINTS:   1
REFERENCES:   200
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/16/2016 5:42 PM

 

58. When are you required to use a for statement, and what are the advantages of for statements?

ANSWER:   You never are required to use a for statement for any loop. A while loop can always be used instead of a for loop, but when a loop’s execution is based on a loop control variable progressing from a known starting value to a known ending value in equal steps, the for loop provides a convenient shorthand. It is easy for others to read, and because the loop control variable’s initialization, testing, and alteration are all performed in one location, you are less likely to leave out one of these crucial elements.
POINTS:   1
REFERENCES:   200
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/16/2016 5:46 PM

 

59. What is an accumulator?

ANSWER:   An accumulator is a variable that you use to gather or accumulate values, and is very similar to a counter that you use to count loop iterations.
Usually, however, you add just one to a counter, whereas you add some other value to an accumulator.
POINTS:   1
REFERENCES:   205-206
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   10/16/2016 5:48 PM

 

60. How might user data be validated?

ANSWER:   When you ask a user to enter data into a computer program, you have no assurance that the data the user enters will be accurate. Loops are frequently used to validate data; that is, to make sure it falls within an acceptable range. For example, suppose part of a program you are writing asks a user to enter a number that represents his or her birth month. If the user types a number less than 1 or greater than 12, you must take some sort of action. For example:
• You could display an error message and stop the program.
• You could choose to assign a default value for the month (for example, 1) before proceeding.
• You could reprompt the user for valid input.
POINTS:   1
REFERENCES:   209
QUESTION TYPE:   Subjective Short Answer
HAS VARIABLES:   False
STUDENT ENTRY MODE:   Basic
TOPICS:   Critical Thinking
DATE CREATED:   9/12/2016 12:41 PM
DATE MODIFIED:   9/12/2016 12:41 PM

 

 

Additional information

Add Review

Your email address will not be published. Required fields are marked *