Programming Design and Logic
Chapter 6 and 7 Questions and
Answers
Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0.
Which of the following is an allowed operation? - ANSWER-values[4] = 80
values[2] = values[4] - values[0]
output values[3]
all of the above
Filling an array with values during a program's execution is known as ___________
the array. - ANSWER-populating
A ___________ is a variable that can be set to indicate whether some event has
occurred. - ANSWER-flag
What do you call two arrays in which each element in one array is associated with
the element in the same relative position in the other array? - ANSWER-parallel
arrays
In most modern programming languages, the highest subscript you should use with
a 12-element array is __________. - ANSWER-11
Parallel arrays _____________. - ANSWER-frequently have an indirect relationship
Each element in a seven-element array can hold value(s) - ANSWER-one
Suppose that an instructor assigns different letter grades based on points earned on
a 10-point quiz, and that all scores have been verified to be between 0 and 10
inclusive. Also suppose that four possible letter grades can be assigned and that 9 or
10 points is an A, 7 or 8 points is a B, 6 points is a C, and 5 or fewer points is an F.
To assign letter grades, the most efficient numeric array containing point values
would contain __________ elements. - ANSWER-three
When you use a subscript value that is negative or higher than the number of
elements in an array. - ANSWER-the resulting action depends on the programming
language used
In every array, a subscript is out of bounds when it is ____________. - ANSWER-
negative
You can access every element of an array using a _________. - ANSWER-while
loop
for loop
Chapter 6 and 7 Questions and
Answers
Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0.
Which of the following is an allowed operation? - ANSWER-values[4] = 80
values[2] = values[4] - values[0]
output values[3]
all of the above
Filling an array with values during a program's execution is known as ___________
the array. - ANSWER-populating
A ___________ is a variable that can be set to indicate whether some event has
occurred. - ANSWER-flag
What do you call two arrays in which each element in one array is associated with
the element in the same relative position in the other array? - ANSWER-parallel
arrays
In most modern programming languages, the highest subscript you should use with
a 12-element array is __________. - ANSWER-11
Parallel arrays _____________. - ANSWER-frequently have an indirect relationship
Each element in a seven-element array can hold value(s) - ANSWER-one
Suppose that an instructor assigns different letter grades based on points earned on
a 10-point quiz, and that all scores have been verified to be between 0 and 10
inclusive. Also suppose that four possible letter grades can be assigned and that 9 or
10 points is an A, 7 or 8 points is a B, 6 points is a C, and 5 or fewer points is an F.
To assign letter grades, the most efficient numeric array containing point values
would contain __________ elements. - ANSWER-three
When you use a subscript value that is negative or higher than the number of
elements in an array. - ANSWER-the resulting action depends on the programming
language used
In every array, a subscript is out of bounds when it is ____________. - ANSWER-
negative
You can access every element of an array using a _________. - ANSWER-while
loop
for loop