Programming Logic and Design,
Chapter 6, Review Questions and
Answers
6. Suppose that you have declared a numeric array named numbers, and two of its
elements are numbers[1] and numbers[4]. You know that .
a. numbers[4] is larger than numbers[1]
b. the array has at least five elements
c. the array has been initialized
d. the two elements are three bytes apart in memory - ANSWER-b.
7. Suppose that you want to write a program that inputs customer data and displays
a summary of the number of customers who owe more than $1000 each, in each of
12 sales regions. Customer data variables include name, zipCode, balanceDue, and
regionNumber. At some point during record processing, you would add to an array
element whose subscript would be represented by .
a. name
b. zipCode
c. balanceDue
d. regionNumber - ANSWER-d.
8. A program contains a seven-element array that holds the names of the days of the
week. At the start of the program, you display the day names using a subscript
named dayNum. You display the same array values again at the end of the program,
where you as a subscript to the array.
a. must use dayNum
b. can use dayNum, but can also use another variable
c. must not use dayNum
d. must use a numeric constant instead of a variable - ANSWER-b.
9. Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0.
Which of the following is an allowed operation?
qa. values[2] = 17
b. input values[0]
c. values[3] = values[0] + 10
d. all of the above - ANSWER-d.
10. Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0.
Which of the following is an allowed operation?
a. values[4] = 80
Chapter 6, Review Questions and
Answers
6. Suppose that you have declared a numeric array named numbers, and two of its
elements are numbers[1] and numbers[4]. You know that .
a. numbers[4] is larger than numbers[1]
b. the array has at least five elements
c. the array has been initialized
d. the two elements are three bytes apart in memory - ANSWER-b.
7. Suppose that you want to write a program that inputs customer data and displays
a summary of the number of customers who owe more than $1000 each, in each of
12 sales regions. Customer data variables include name, zipCode, balanceDue, and
regionNumber. At some point during record processing, you would add to an array
element whose subscript would be represented by .
a. name
b. zipCode
c. balanceDue
d. regionNumber - ANSWER-d.
8. A program contains a seven-element array that holds the names of the days of the
week. At the start of the program, you display the day names using a subscript
named dayNum. You display the same array values again at the end of the program,
where you as a subscript to the array.
a. must use dayNum
b. can use dayNum, but can also use another variable
c. must not use dayNum
d. must use a numeric constant instead of a variable - ANSWER-b.
9. Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0.
Which of the following is an allowed operation?
qa. values[2] = 17
b. input values[0]
c. values[3] = values[0] + 10
d. all of the above - ANSWER-d.
10. Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0.
Which of the following is an allowed operation?
a. values[4] = 80