Exam 16: Searching and Sorting
Exam 1: An Overview of Computers and Programming Languages40 Questions
Exam 2: Basic Elements of C++50 Questions
Exam 3: Inputoutput40 Questions
Exam 4: Control Structures I Selection40 Questions
Exam 5: Control Structures II Repetition40 Questions
Exam 6: User-Defined Function41 Questions
Exam 7: Namespaces, the Class String, and User-Defined Simple Data Types40 Questions
Exam 8: Arrays40 Questions
Exam 9: Records Structs40 Questions
Exam 10: Classes and Data Abstraction43 Questions
Exam 11: Inheritance and Composition41 Questions
Exam 12: Pointers, Classes, Virtual Functions, and Abstract Classes43 Questions
Exam 13: Overloading and Templates41 Questions
Exam 14: Exception Handling42 Questions
Exam 15: Recursion41 Questions
Exam 16: Searching and Sorting46 Questions
Exam 17: Linked Lists41 Questions
Exam 18: Stacks and Queues42 Questions
Select questions type
For a list of length n, the bubble sort makes exactly ____ key comparisons.
Free
(Multiple Choice)
4.9/5
(31)
Correct Answer:
A
The code shown represents the ____________________ search algorithm.


Free
(Short Answer)
4.7/5
(33)
Correct Answer:
sequential
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.
Free
(True/False)
4.9/5
(34)
Correct Answer:
True
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.7/5
(36)
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 ____.
(Multiple Choice)
4.9/5
(32)
Assume that n = 1000. To sort the list, insertion sort makes about 250,000 item assignments.
(True/False)
4.8/5
(47)
A(n) ____________________ search uses the "divide and conquer" technique to search the list.
(Short Answer)
4.8/5
(37)
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
(41)
The formula to find the index of the middle element of a list is ____.
(Multiple Choice)
4.9/5
(34)
The type vector provides the function ____________________, which returns the first element in the vector object.
(Short Answer)
4.7/5
(43)
The insertion sort algorithm sorts the list by moving each element to its proper place.
(True/False)
4.8/5
(36)
In the bubble sort algorithm, which code accomplishes swapping values in elements at positions index and index + 1?
(Multiple Choice)
4.9/5
(32)
If you want to use the class vector in your program, you must include the following statement: ____________________.
(Short Answer)
4.9/5
(36)
The sequential search algorithm uses a(n) ____ variable to track whether the item is found.
(Multiple Choice)
4.8/5
(33)
For a list size of 1000, on average, the sequential search makes about ____________________ key comparisons.
(Short Answer)
4.7/5
(34)
In a sequential search, if a search item is not in a list of 1000 elements, then ____ key comparisons will be made.
(Multiple Choice)
4.8/5
(38)
Showing 1 - 20 of 46
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)