Exam 16: Searching, Sorting and the Vector Type

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Assume that n = 1000. To sort the list, bubble sort makes about ____ item assignments.

(Multiple Choice)
4.7/5
(42)

The insertion sort algorithm sorts the list by moving each element to its proper place.

(True/False)
4.9/5
(35)

A variable declared using the vector type is called a ____.

(Multiple Choice)
4.7/5
(35)

For sorting a list of length n, bubble sort uses ____ iterations.

(Multiple Choice)
4.8/5
(32)

The type vector provides the expression ____________________, which returns the last element of the object.

(Short Answer)
4.8/5
(40)

All of the values in a list have the same type.

(True/False)
4.8/5
(33)

If you initially declare a vector object and do not specify its size, then in order to add elements to the vector object, we use the function ____________________.

(Short Answer)
4.9/5
(37)

The bubble sort makes fewer item assignments than comparisons with a list of 1000 elements.

(True/False)
4.9/5
(40)

With the binary search algorithm, ____ key comparison(s) is/are made in the successful case-the last time through the loop.

(Multiple Choice)
4.9/5
(36)

A sequential search is much faster than a binary search.

(True/False)
4.8/5
(43)

If the search item is the 900th item in the list, the sequential search makes ____ key comparisons to determine whether the search item is in the list.

(Multiple Choice)
4.8/5
(32)

Which of the following statements declares intList to be a vector object of size 10?

(Multiple Choice)
5.0/5
(38)

Consider the following list: int list[] = {4, 8, 19, 25, 34, 39, 45, 48, 66, 75, 89, 95} When performing a binary search, the element to be found is first compared with ____.

(Multiple Choice)
4.8/5
(34)

The type vector provides the expression ____________________, which returns the maximum number of elements that can be inserted into the object vecList.

(Short Answer)
4.8/5
(34)

In the insertion sort function, the variable firstOutOfOrder is initialized to ____, assuming n is the length of the list.

(Multiple Choice)
4.7/5
(31)

The statement vector<elemType>____________________; creates the vector object vecList of size n.

(Short Answer)
4.7/5
(45)

Which of the following statements declares intList to be an empty vector?

(Multiple Choice)
4.7/5
(46)

In a bubble sort, the smaller elements move toward the bottom, and the larger elements move toward the top of the list.

(True/False)
4.9/5
(31)

The type vector provides the function ____________________, which returns the first element in the vector object.

(Short Answer)
4.8/5
(34)

The size of a list is fixed and cannot be increased or decreased.

(True/False)
4.7/5
(42)
Showing 21 - 40 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)