Online Quiz on Advanced Array - Attempt 1 1 Marks: 1/1 The following statements creates alpha to be a two-dimeansional array of 25 rows and 10 columns. int[][] alpha = new int[25][10]; Answer: True False Refer Page 568 in Malik Textbook for explanation Submit
Correct Marks for this submission: 1/1. 2 Marks: 1/1 Which technique does a binary search use to find an element in a list? Choose one answer. a. divide and conquer b. row and column c. first to last d. hunt and peck Submit
Correct Marks for this submission: 1/1. 3 Marks: 1/1 Linear search is another name for sequential search. Answer: True
False
Submit
Correct Marks for this submission: 1/1. 4 Marks: 1/1
Which of the following about Java arrays is true? (i) All components must be of the same type. (ii) The array index and array element must be of the same type. Choose one answer. Refer Page 531 in Malik Textbook
a. Only (i) b. Only (ii) c. Both (i) and (ii) d. None of these Submit
Correct Marks for this submission: 1/1. 5 Marks: 1/1 A method that calls itself is an iterative method. Answer: True False It is called recursion Submit
Correct Marks for this submission: 1/1. 6 Marks: 1/1 The process of solving a problem by reducing it to smaller versions of itself is called recursion. Answer: True
False
Submit
Correct Marks for this submission: 1/1. 7 Marks: 1/1 Suppose that you have the following declarations. int[] alpha = new int[100]; int[][] beta = new int[25][4];
In this declaration, the array alpha has more components than the array beta. Answer: True False Refer page 531 and 568 in Malik Textbook Submit
Correct Marks for this submission: 1/1. 8 Marks: 0.9/1 Suppose you have the following declaration: char[] nameList = new char[100]; Which of the following range is valid for the index of the array nameList. (i) 1 through 100 (ii) 0 through 100 Choose one answer. a. Only (i) b. Only (ii) c. Both are invalid
The valid range for the index of the array nameList is 0 through 99
d. None of these Submit
Correct Marks for this submission: 1/1. With previous penalties this gives 0.9/1. 9 Marks: 0/1 For a list size of 500, on average, the sequential search makes about 250 comparisons. Answer: True
False
Submit
Correct Marks for this submission: 1/1. With previous penalties this gives 0/1. 10 Marks: 1/1
What is usually returned if the search item is found during a search of a list? Choose one answer. a. the location of the element b. the element c. -1 d. nothing Submit
Correct Marks for this submission: 1/1. 11 Marks: 1/1 To design a general-purpose search method, searchList, to search a list, which of the following must be parameters of the method searchList. (i) The array containing the list. (ii) The length of the list. (iii) The search item. (iv) A boolean variable indicating whether the search is successful. Choose one answer. a. (i) and (ii) b. (i), (ii), and (iii) c. (ii), (iii), and (iv) d. (i), (ii), (iii), and (iv) Submit
Correct Marks for this submission: 1/1. 12 Marks: 1/1 int[] num = new int[100]; for (int i = 0; i < 50; i++) num[i] = i; num[5] = 10; num[55] = 100;
What is the value of num.length in the array above? Choose one answer. a. 0 b. 99 c. 100 d. 101 Submit
Correct Marks for this submission: 1/1. 13 Marks: 1/1 To search through a list you need to know the length of the list. Answer: True
False
Submit
Correct Marks for this submission: 1/1. 14 Marks: 1/1 Recursive algorithms are implemented using while loops. Answer: True False Recursive algorithms are implemented by creating a new method Submit
Correct Marks for this submission: 1/1. 15 Marks: 1/1 A sequential search is faster than a binary search on sorted lists. Answer: True False binary search is faster Submit
Correct
Marks for this submission: 1/1. 16 Marks: 1/1 In a linear search, you search an array starting from the middle component. Answer: True
False
Submit
Correct Marks for this submission: 1/1. 17 Marks: 1/1 A binary search starts by comparing the search item to the first item in the list. Answer: True False A binary search starts by comparing the search item from the middle of the list. Submit
Correct Marks for this submission: 1/1. 18 Marks: 1/1 To design a general-purpose sort method, sortList, to sort a list, which of the following must be parameters of the method sortList. (i) The array containing the list. (ii) The length of the list. (iii) A boolean variable indicating whether the sort was successful.
Choose one answer. a. (i) b. (ii) c. (i) and (ii) d. (i), (ii), and (iii) Submit
Correct Marks for this submission: 1/1.