Filters
Question type

Study Flashcards

A binary search requires that the elements be in order.

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

The________ sort usually performs fewer exchanges than the________ sort.


A) selection, bubble
B) bubble, selection
C) linear, bubble
D) linear, binary
E) binary, linear

F) B) and D)
G) B) and C)

Correct Answer

verifed

verified

A search can be performed on an array of


A) strings.
B) integers.
C) objects.
D) all of the above.
E) A and B, but not C.

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

Correct Answer

verifed

verified

When sorting an array of objects or structures, one must decide which data item to sort on.

A) True
B) False

Correct Answer

verifed

verified

A(n) ________search is more efficient than a(n) ________search.


A) integer, double
B) string, double
C) binary, linear
D) linear, binary
E) None of the above. All searches are equally efficient.

F) None of the above
G) B) and D)

Correct Answer

verifed

verified

The search is adequate for searching through small arrays, but not through large ones.


A) random
B) selection
C) binary
D) linear
E) bubble

F) A) and E)
G) A) and D)

Correct Answer

verifed

verified

To determine that a item is not in an unordered array of 100 items, linear search must examine an average of values.


A) 7
B) 10
C) 50
D) 100
E) 101

F) B) and D)
G) C) and E)

Correct Answer

verifed

verified

To locate a value in an ordered array of 100 items, binary search must examine at most values.


A) 7
B) 10
C) 50
D) 100
E) 101

F) A) and C)
G) C) and D)

Correct Answer

verifed

verified

If algorithm A requires 2n + 1 basic operations to process an input of size n, and Algorithm B requires 3n + 2 basic operations to process the same input, algorithms A and B are considered to be equally efficient.

A) True
B) False

Correct Answer

verifed

verified

To locate a value that is in an ordered array of 50 items, linear search must examine at most values.


A) 1
B) 6
C) 25
D) 50
E) 51

F) All of the above
G) A) and C)

Correct Answer

verifed

verified

Bubble sort and selection sort can also be used with STL vectors.

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

A binary search begins by examining the _ element of an array.


A) smallest
B) last
C) largest
D) middle
E) first

F) C) and D)
G) B) and C)

Correct Answer

verifed

verified

The advantage of a linear search is that


A) it is simple.
B) it is efficient.
C) it is fast.
D) it can be used on unordered data.
E) both A and D

F) B) and C)
G) A) and B)

Correct Answer

verifed

verified

We can estimate the of an algorithm by counting the number of steps it requires to solve a problem.


A) code quality
B) number of lines of code
C) run time
D) efficiency
E) result

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

Correct Answer

verifed

verified

Showing 21 - 36 of 36

Related Exams

Show Answer