Chapter 6 Practice Quiz

docx

School

Ivy Tech Community College, Indianapolis *

*We aren’t endorsed by this school

Course

120

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

4

Uploaded by MasterBaboon3951

Report
Chapter 6 Practice Quiz 1. A subscript is a(n) . a. element in an array b. alternate name for an array c. number that represents the highest value stored within an array d. number that indicates the position of an array element 2. Each element in an array must have the same as the others. a. data type b. subscript c. value d. memory location 3. Suppose that you have declared a numeric array named values that has 13 elements. Which of the following must be true? a. values[0] is smaller than values[1] b. values[2] is stored adjacent to values[4] c. values[13] is out of bounds d. values[12] is the largest value in the array 4. The subscripts of any array are always . a. integers b. fractions c. characters d. strings of characters 5. 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. the two elements hold the same value b. the array holds exactly four elements c. there are exactly two elements between those two elements d. the two elements are at the same memory location 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 7. Suppose that you want to write a program that inputs customer data including name, zipCode, balance, and regionNum. At the end of the program, a summary of the number
of customers in each of 12 sales regions who owe more than $1,000 each is displayed. The most likely statement during the main processing loop would be . a. customerCount[balance] = customerCount[balance] + 1 b. customerCount[regionNum] = customerCount[regionNum] + 1 c. customerCount[regionNum] = regionNum - 1 d. customerCount[balance] = balance + customerCount[regionNum] 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 numeric value c. must not use dayNum d. must use a numeric constant instead of a variable 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? a. values[2] = 17 b. input values[0] c. values[3] = values[0] + 10 d. all of the above 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 b. values[2] = values[4] - values[0] c. output values[3] d. all of the above 11. Filling an array with values during a program’s execution is known as the array. a. executing b. colonizing c. populating d. declaring 12. A is a variable that can be set to indicate whether some event has occurred. a. subscript b. banner c. counter d. flag
13. Two arrays in which each element in one array is associated with the element in the same relative position are . a. cohesive b. parallel c. hidden d. perpendicular 14. In most modern programming languages, the highest subscript you should use with a 12- element array is . a. 10 b. 11 c. 12 d. 13 15. Parallel arrays . a. frequently have an indirect relationship b. never have an indirect relationship c. must be the same data type d. must not be the same data type 16. Each element in a seven-element array can hold value(s). a. one b. seven c. at least seven d. an unlimited number of 17. 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. a. ten b. five c. four d. three 18. When you use a subscript value that is negative or higher than the number of elements in an array, . a. execution of the program stops and an error message is issued b. a value in a memory location that is outside the area occupied by the array will be accessed c. a value in a memory location that is outside the area occupied by the array will be accessed, but only if the value is the correct data type d. the resulting action depends on the programming language used 19. In every array, a subscript is out of bounds when it is .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
a. negative b. 0 c. 1 d. 999 20. You can access every element of an array using a . a. while loop b. for loop c. either of the above d. none of the above