Python Programming for
Engineers and Scientists 1e By
Cengage
(All Chapters 1-13, 100% Original
Verified, A+ Grade)
All Chapters Arranged Reverse: 13-1
This is the Original Test Bank for 1st
Edition, All Other Files in the Market
are Wrong/Old Questions.
,Name Clas Dat
: s: e:
Chapter 13 Searching Sorting and Complexity Analysis
1. Algorithms describe processes that run on real computers with finite resources.
a. True
b. Fals
e
ANSWER: True
2. The time() function of the time module can be used to track the running time of a program.
a. True
b. Fals
e
ANSWER: True
3. An algorithm coded in Python usually runs slightly faster than the same algorithm coded in C.
a. True
b. Fals
e
ANSWER: False
4. When you count instructions to estimate the efficiency of an algorithm, you count the instructions in the executable
machine language program.
a. True
b. Fals
e
ANSWER: False
5. Of the techniques that can be used to determine the efficiency of an algorithm, which is based on a calculated average
run time?
a. benchmarking
b. instruction counting
c. big-O notation
d. memoization
ANSWER: a
6. What function can you use to record the start and end times of a block of code, so that you can 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()
ANSWER: b
7. When you are choosing an algorithm, faster run times can often be achieved at the expense of what other resource?
a. hard drive space
b. processing power
Copyright Cengage Learning. Powered by Cognero. Page 1
,Name Clas Dat
: s: e:
Chapter 13 Searching Sorting and Complexity Analysis
c. memory space
d. instruction
counts
ANSWER: c
8. What is one major problem with the benchmark technique of measuring algorithm efficiency?
a. Different hardware platforms have different processing speeds, meaning the running
times will differ on different machines.
b.A benchmark test does not account for differences in the size of data sets.
c. The test cannot be performed without modifying the code for which the benchmark
will be performed.
d.It can be impractical to determine the running time for algorithms with very small data
sets.
ANSWER: a
9. When using the counting instructions method of measuring algorithm efficiency, you place each instruction into one of
two categories based on _____.
a. whether or not the instruction performs an assignment operation
b. whether or not the instruction is part of a function
c. whether the instruction’s execution count varies based on problem size
d. whether the instruction’s execution count varies based on the number of lines of code
ANSWER: c
10. Some algorithms require more memory as the problem size gets larger.
a. True
b. Fals
e
ANSWER: True
11. Which of the following describes a linear algorithm?
a. an algorithm whose work grows exponentially in relation to the size of the problem
b. an algorithm whose work grows as a power of three each time the problem size
increases
c. an algorithm whose work grows in direct proportion to the size of the problem
d. an algorithm whose work grows at a rate of nk, where k is a constant greater than 1
ANSWER: c
12. Which of the following describes a quadratic algorithm?
a. an algorithm whose work grows as a square of the problem size
b. an algorithm whose work grows as a power of three each time the problem size
increases
c. an algorithm whose work grows in direct proportion to the size of the problem
d. an algorithm whose work grows at a rate of nk, where k is a constant greater than 1
ANSWER: a
Copyright Cengage Learning. Powered by Cognero. Page 2
, Name Clas Dat
: s: e:
Chapter 13 Searching Sorting and Complexity Analysis
13. In terms of order of complexity, what is the most efficient kind of performance to have?
a. linear
b. quadratic
c. constant
d. logarithmi
c
ANSWER: c
14. Algorithms with linear behavior do less work than algorithms with quadratic behavior for most problem sizes n.
a. True
b. Fals
e
ANSWER: True
15. As the problem size gets larger, the performance of an algorithm with the higher order of complexity becomes worse
more quickly.
a. True
b. Fals
e
ANSWER: True
16. Logarithmic complexity is better than constant but worse than linear complexity.
a. True
b. Fals
e
ANSWER: False
17. An order of complexity that is worse than polynomial is called quadratic.
a. True
b. Fals
e
ANSWER: False
18. Whenever the amount of work of an algorithm is expressed as a polynomial, we focus on one term as dominant.
a. True
b. Fals
e
ANSWER: True
19. List indexing is an example of a quadratic-time algorithm.
a. True
b. Fals
e
ANSWER: False
Copyright Cengage Learning. Powered by Cognero. Page 3