Filters
Question type

Study Flashcards

The first element in a vector object is at location ____________________.

Correct Answer

verifed

verified

A(n) ____________________ search uses the "divide and conquer" technique to search the list.

Correct Answer

verifed

verified

The sequential search algorithm uses a(n) ____ variable to track whether the item is found.


A) int
B) bool
C) char
D) double

Correct Answer

verifed

verified

In order to apply a(n) ____________________ search, the list must be sorted.

Correct Answer

verifed

verified

Sequential search typically searches ____.


A) one quarter of the list
B) one third of the list
C) one half of the list
D) the entire list

Correct Answer

verifed

verified

C

____ is one of the basic operations that may be performed on a list.


A) Searching the list
B) Reversing the order of the elements
C) Finding the maximum element
D) Displaying the elements

Correct Answer

verifed

verified

After the second iteration of bubble sort for a list of length n, the last ____ are sorted.


A) element
B) two elements
C) three elements
D) n-2

Correct Answer

verifed

verified

The type vector provides the expression ____________________, which inserts a copy of elem into vecList at the end.

Correct Answer

verifed

verified

push_back(...

View Answer

Consider the following list. int list[] = {4, 8, 19, 25, 34, 39, 45, 48, 66, 75, 89, 95} When performing a binary search for 75, after the first comparison, the search is restricted to ____.


A) list[0]...list[6]
B) list[0]...list[7]
C) list[5]...list[11]
D) list[6]...list[11]

Correct Answer

verifed

verified

The code below represents the ____________________ search algorithm. int unknownSearch(const int list[], int listLength, int searchItem) { \quad int loc; \quad bool found = false; \quad loc = 0; \quad while (loc < listLength && !found) \quad\quad if (list[loc] == searchItem) \quad\quad\quad found = true; \quad\quad else \quad\quad\quad loc++; \quad if (found) \quad\quad return loc; \quad else \quad\quad return -1; }

Correct Answer

verifed

verified

During the sorting phase of insertion sort, the array containing the list is divided into two sublists, sorted and unsorted.

Correct Answer

verifed

verified

The statement ____ returns the element at the position index in vector vecList.


A) vecList[index]
B) vecList.get(index)
C) vecList.front(index)
D) vecList<index>

Correct Answer

verifed

verified

A

For a list size of 1000, on average, the sequential search makes about ____________________ key comparisons.

Correct Answer

verifed

verified

The statement ____ creates the vector object vecList of size size.


A) vector[elemType] vecList(size) ;
B) vector<elemType> vecList(size) ;
C) vector(size) vecList<elementType>
D) vector{ele

Correct Answer

verifed

verified

Assume that n = 1000. To sort the list, insertion sort makes about 250,000 item assignments.

Correct Answer

verifed

verified

Assuming that list consists of the following elements, what is the result after bubble sort completes? int list[] = {2, 56, 34, 25, 73, 46, 89, 10, 5, 16};


A) 89 73 56 46 34 25 16 10 5 2
B) 2 56 34 25 5 16 89 46 73
C) 2 5 10 16 25 34 46 56 73 89
D) 2 10 16 25 34 46 56 73 89

Correct Answer

verifed

verified

The sequential search algorithm does not assume that the list is sorted.

Correct Answer

verifed

verified

Which of the following statements declares intList to be a vector of size 5 and the element to be of type int?


A) vector intList[5];
B) vector<int> intList(5) ;
C) vector<int> intList() ;
D) vector(int) intList[5];

Correct Answer

verifed

verified

B

The performance of bubble sort can be improved if we stop the sorting process as soon as we find that, in an iteration, no swapping of elements takes place.

Correct Answer

verifed

verified

For a list of length n, insertion sort makes ____ item assignments.


A) n(n-1) /4
B) n(n-1) /2
C) n2
D) n3

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer