Filters
Question type

Study Flashcards

Python's is operator is implemented as a method named __contains__ in the list class.

A) True
B) False

Correct Answer

verifed

verified

What statement accurately describes the strategy utilized by the selection sort algorithm?


A) The selection sort algorithm repeatedly swaps elements that are out of order in a list until they are completely sorted.
B) The selection sort algorithm repeatedly swaps the smallest element in an unsorted portion of a list with an element at the start of the unsorted portion.
C) The selection sort algorithm repeatedly inserts the i-th element into its proper place in the first i items in the list.
D) The selection sort algorithm partitions a list around a pivot item and sorts the resulting sublists.

E) All of the above
F) None of the above

Correct Answer

verifed

verified

What function can you use to record the start and end times of a block of code, and then use the difference between the resulting values to determine the elapsed time in seconds?


A) time.ctime()
B) time.time()
C) time.count()
D) time.epoch()

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

Correct Answer

verifed

verified

What statement regarding the development of fast algorithms is accurate?


A) As a rule, any reduction in the order of magnitude of complexity is preferable to a tweak in code that reduces the constant of proportionality.
B) As a rule, any reduction in the constant of proportionality is preferable to a tweak that reduces the order of magnitude in complexity.
C) As a rule, any reduction in the lines of code required to make an algorithm function is desirable to that of faster run times.
D) As a rule, any reduction in the use of memory required by an algorithm is preferred over a tweak that improves run times.

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

Correct Answer

verifed

verified

When analyzing an algorithm, one must be careful to determine that any instructions do not hide a loop that depends on a variable problem size.

A) True
B) False

Correct Answer

verifed

verified

Of the numerous sorting algorithms, what algorithm employs a recursive, divide-and-conquer strategy that breaks a list in two at the middle point and recursively sorts the lists?


A) quicksort
B) insertion sort
C) bubble sort
D) merge sort

E) None of the above
F) All of the above

Correct Answer

verifed

verified

Selection sort starts at the beginning of the list and compares pairs of data items as it moves down to the end.

A) True
B) False

Correct Answer

verifed

verified

The insertion, bubble, and selection sort algorithms are all examples of algorithms that have what big-O notation run times?


A) O(n log n)
B) O(n^n)
C) O(n**2)
D) O(n**3)

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

Correct Answer

verifed

verified

Of the techniques that can be used to determine the efficiency of an algorithm, which is based on a calculated average of average run time?


A) benchmarking
B) instruction counting
C) set analyzing
D) process profiling

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

Correct Answer

verifed

verified

Binary search is less efficient than linear search.

A) True
B) False

Correct Answer

verifed

verified

O(n log n) running times are better than O(n^2) running times.

A) True
B) False

Correct Answer

verifed

verified

Showing 41 - 51 of 51

Related Exams

Show Answer