Documente Academic
Documente Profesional
Documente Cultură
1
Marks: 1/1
The following statements creates alpha to be a two-dimeansional array of 25 rows and 10
columns.
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?
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.
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.
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:
Which of the following range is valid for the index of the array nameList.
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?
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.
Correct
Marks for this submission: 1/1.
12
Marks: 1/1
int[] num = new int[100];
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.
Correct
Marks for this submission: 1/1.