2. When you declare an array, _____. | a. you cannot reserve memory for it in the same statement | | | | b. you might reserve memory for it in the same statement | | | | c. the ability to reserve memory for it in the same statement depends on the type of the array | | | | d. you always reserve memory for it in the same statement 3. You reserve memory locations for an array when you _____. | | | c. explicitly store values within the array elements | | | | d. declare the array name 4. The _____ field contains the number of elements in the array. | | | | d. capacity 5. Which of the following can be used as an array subscript? | | | | d. double 6. The _____ allows you to cycle through an array without specifying the starting and ending points for the loop control variable. | | | | d. forevery loop 7. To construct an array of objects using a default constructor, you must call the constructor using the keyword new for_____. | a. each declared array element | | | | | c. only the array itself, not the individual elements | | | | d. only the first element 8. In a _____, you commonly compare a value to the low or high endpoint of each of a series of numerical ranges, but not to the midpoint. | | | | d. array comparison 9. Unicode value '\u0000' is also known as _____. | | | | d. void 10. When you initialize an array by giving it values upon creation, you _____. | a. also must give the array a size explicitly | | | | b. must make all the values zero, blank, or false | | | | c. must make certain each value is different from the others | | | | d. do not explicitly give the array a size 11. In Java, you can declare an array of 12 elements and initialize _____. | | | | d. only the first one 12. A variable that holds a value as an indicator of whether some condition has been met is known as a(n) _____. | | | | d. flag 13. A(n) _____ of an object is an instance variable or field. | | | | d. attribute 14. Providing values for all the elements in an array is called _____. | | | | d. assignment 15. A parallel array is one that _____. | a. holds an even number of values | | | | b. is placed adjacent to another array in code | | | | c. holds values that correspond to those in another array | | | | d. is placed adjacent to another array in memory 16. In which of the following situations would setting up parallel arrays be most useful? | a. You need to look up an employee's ID number to find the employee's last name. | | | | b. You need to determine the shortest distance between two points on a map. | | | | c. You need to store a list of 20 commonly misspelled words. | | | | d. You need to calculate interest earned on a savings account balance. 17. When you pass an array element to a method, the method receives _____. | a. a copy of the value in the element | | | | b. the address of the array | | | | c. the address of the element | | | | d. a copy of the array 18. A single array element of a primitive type is passed to a method by _____. | | | | d. value 19. When you pass an array to a method, the method receives _____. | | b. the address of the array | | | | c. a copy of the first element in the array | | | | d. nothing 20. If a method should return an array to its calling method _____. | a. A Java method cannot return an array | | | | b. the return type in the method header is followed by square brackets | | | | c. the return type in the method header is preceded by an ampersand | | | | d. the method's return type must match its parameter type | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |