Filters
Question type

Study Flashcards

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

Correct Answer

verifed

verified

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


A) 0
B) 1
C) n - 1
D) n

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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 ____.


A) 4
B) 25
C) 39
D) 95

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

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.


A) 100
B) 900
C) 9000
D) 90,000

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

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


A) vector intList() ;
B) vector<int> intList(0) ;
C) vector<int> intList(10) ;
D) vector<int> intList;

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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


A) 10,000
B) 100,000
C) 250,000
D) 500,000

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) vector element
B) vector array
C) vector list
D) vector container

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

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


A) vector intList() ;
B) vector<int> intList(0) ;
C) vector<int> intList(10) ;
D) vector<int> intList;

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

A sequential search is much faster than a binary search.

A) True
B) False

Correct Answer

verifed

verified

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


A) one
B) two
C) n-2
D) n

E) A) and B)
F) A) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) 1
B) n - 1
C) n
D) n + 1

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

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 ____________________.

Correct Answer

verifed

verified

push_back
...

View Answer

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

A) True
B) False

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer