Chapter 8 C++ Quiz

Ace your homework & exams now with Quizwiz!

Data that is sorted in ascending order is ordered a. from lowest to highest value b. from highest to lowest value c. always with a binary sort algorithm d. always with a linear sort algorithm e. None of these

A

Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, ____________ element(s) must be compared. a. 20,000 b. only the first c. only half d. 2000 e. None of these

A

A ________ algorithm is a method of locating a specific item of information in a larger collection of data. a. sort b. search c. standard d. linear e. None of these

B

The _________ is adequate for searching through small arrays. a. binary search b. linear search c. unary search d. bubble sort e. None of these

B

A(n) ________ search is more efficient than a(n) ________ search a. character, string b. integer, double c. binary, linear d. linear, binary e. None of these

C

A(n) ________ search uses a loop to sequentially step through an array. a. binary b. unary c. linear d. relative e. None of these

C

Array elements must be _________ before a binary search can be performed. a. summed b. set to zero c. sorted d. positive numbers e. None of these

C

The _________ sort usually performs fewer exchanges than the ________ sort. a. bubble, selection b. binary, linear c. selection, bubble d. ANSI, ASCII e. None of these

C

The advantage of a linear search is its ____________. a. complexity b. efficiency c. simplicity d. speed e. None of these

C

When an array is sorted from highest to lowest, it is said to be in _____ order. a. reverse b. forward c. descending d. ascending e. None of these

C

___________ algorithms are used to arrange random data into some order. a. Standard search b. Linear c. Sorting d. Binary search e. None of these

C

A binary search begins with the _________ element of an array. a. first b. last c. largest d. middle e. None of these

D

Regardless of the algorithm being used, a search through an array is always performed a. from lowest to highest element b. from highest to lowest element c. beginning with the middle element d. using a binary search e. None of these

E

True/False: A linear search can only be implemented with integer values.

F

True/False: Before you can perform a bubble sort, the data must be stored in descending order.

F

True/False: Before you can perform a selection sort, the data must be stored in ascending order.

F

True/False: The bubble sort is an easy way to arrange data into ascending order, but it cannot arrange data into descending order.

F

True/False: Using a binary search, you are more likely to find an item than if you use a linear search.

F

True/False: In the average case, an item is just as likely to be found near the beginning of an array as near the end.

T

True/False: The number of comparisons made by a binary search is expressed in powers of two.

T


Related study sets

Business 201 Mid Term Exam Study Guide

View Set

Ch. 14: Preoperative Patient Care

View Set

Wireless Network and its Security

View Set

Croup, Epiglottis, & Bronchiolitis

View Set

Chapter 1-3 LearnSmart & Quizzes

View Set

Chapter 40: Management of Patients with Gastric and Duodenal Disorders

View Set

Intro to business final exam practice test 2

View Set