To Purchase
this Complete Test Bank with Answers Click the link Below
https://tbzuiqe.com/product/invitation-to-computer-science-7th-edition-g-michael-schneider-judith-gersting-test-bank/
If face any problem or
Further information contact us At tbzuiqe@gmail.com
Sample Test
Chapter_03_The_Efficiency_of_Algorithms
1. The properties that make better algorithms are very
similar to the properties we look for when purchasing a car.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
92
|
|
2. The time an algorithm takes on
a particular machine is the best way for comparing two algorithms that do the
same task.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
96
|
|
3. If we were to run the
sequential search algorithm many times, with random input values occurring at
various places in the list, we would find the average number of comparisons
done to be approximately n/2.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
99
|
|
4. Sequential search is an order-n algorithm in
the average case.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
101
|
|
5. The sequential search and
selection sort algorithms are different methods to get the same thing done.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
102
|
|
6. The selection sort algorithm
can recognize whether or not the list is already sorted at the beginning.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
107
|
|
7. If an Θ(n2) algorithm and an Θ(n)
algorithm exist for the same task, then for large enough n, the Θ(n2) algorithm does more work
and takes longer to execute, regardless of the constant factors for
peripheral work.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
112
|
|
8. Given a sorted list, the
sequential search algorithm is more efficient than the binary search.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
123
|
|
9. Binary search uses
significantly more space than sequential search.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
129
|
|
10. No one has yet found a
solution algorithm that works in polynomial time, but neither has anyone proved
that such an algorithm does not exist.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
135
|
|
11. First and foremost, we
expect elegance from our algorithms.
_________________________
ANSWER:
|
False – correctness
|
POINTS:
|
1
|
REFERENCES:
|
92
|
|
12. In the sequential search
algorithm, the worst case occurs when the value being
searched for is the first value in the list. _________________________
ANSWER:
|
False – best
|
POINTS:
|
1
|
REFERENCES:
|
98
|
|
13. With sequential search,
the bigger the list of items, the more work that must be
done to search it. _________________________
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
99
|
|
14. The shuffle-left
algorithm is not space-efficient. _________________________
ANSWER:
|
False – is
|
POINTS:
|
1
|
REFERENCES:
|
119
|
|
15. A collection of nodes and
connecting edges is called a(n) vector. _________________________
ANSWER:
|
False – graph
|
POINTS:
|
1
|
REFERENCES:
|
133
|
|
16. ____ is the algorithmic
equivalence of style.
|
a.
|
Efficiency
|
b.
|
Elegance
|
|
c.
|
Aesthetics
|
d.
|
Complexity
|
ANSWER:
|
b
|
POINTS:
|
1
|
REFERENCES:
|
94
|
|
17. ____ involves the fixing of
errors that are uncovered through repeated usage with different input values.
|
a.
|
Program maintenance
|
b.
|
Recycling
|
|
c.
|
Data cleanup
|
d.
|
Garbage collection
|
ANSWER:
|
a
|
POINTS:
|
1
|
REFERENCES:
|
94
|
|
18. ____ are useful for rating one
machine against another and for rating how sensitive a particular algorithm
is with respect to variations in input on one particular machine.
|
a.
|
Time trials
|
b.
|
Benchmarks
|
|
c.
|
Comparison times
|
d.
|
Intensive tests
|
ANSWER:
|
b
|
POINTS:
|
1
|
REFERENCES:
|
96
|
|
19. The study of the efficiency of
algorithms is called the ____ of algorithms.
|
a.
|
design
|
b.
|
analysis
|
|
c.
|
implementation
|
d.
|
testing
|
ANSWER:
|
b
|
POINTS:
|
1
|
REFERENCES:
|
97
|
|
20. In the sequential search
algorithm, the minimum amount of work is done if the value being searched for
is the ____ value in the list.
|
a.
|
first
|
b.
|
second
|
|
c.
|
middle
|
d.
|
last
|
ANSWER:
|
a
|
POINTS:
|
1
|
REFERENCES:
|
98
|
|
21. The ____ case of an algorithm
requires the least work.
|
a.
|
best
|
b.
|
worst
|
|
c.
|
smallest
|
d.
|
largest
|
ANSWER:
|
a
|
POINTS:
|
1
|
REFERENCES:
|
98
|
|
22. In the sequential search
algorithm, the worst case occurs when the value being searched for is the
____ value in the list.
|
a.
|
first
|
b.
|
second
|
|
c.
|
middle
|
d.
|
last
|
ANSWER:
|
d
|
POINTS:
|
1
|
REFERENCES:
|
98
|
|
23. Placing a list of items into
alphabetical or numerical order is called ____.
|
a.
|
simplifying
|
b.
|
searching
|
|
c.
|
sorting
|
d.
|
pattern matching
|
ANSWER:
|
c
|
POINTS:
|
1
|
REFERENCES:
|
103
|
|
24. The ____ sort algorithm performs
the task of sorting a list by growing a sorted subsection of the list from
the back to the front.
|
a.
|
selection
|
b.
|
sequential
|
|
c.
|
shuffle-left
|
d.
|
binary
|
ANSWER:
|
a
|
POINTS:
|
1
|
REFERENCES:
|
103
|
|
25. Selection sort is a(n) ____ algorithm
in all cases.
|
a.
|
Θ(1)
|
b.
|
Θ(n)
|
|
c.
|
Θ(2n)
|
d.
|
Θ(n2)
|
ANSWER:
|
d
|
POINTS:
|
1
|
REFERENCES:
|
111
|
|
26. Sequential search is a(n) ____
algorithm in the worst case.
|
a.
|
Θ(1)
|
b.
|
Θ(n)
|
|
c.
|
Θ(2n)
|
d.
|
Θ(n2)
|
ANSWER:
|
b
|
POINTS:
|
1
|
REFERENCES:
|
111
|
|
27. Part of the job of program
____ is to make clear any assumptions or restrictions about the input size
the program was designed to handle.
|
a.
|
design
|
b.
|
implementation
|
|
c.
|
documentation
|
d.
|
maintenance
|
ANSWER:
|
c
|
POINTS:
|
1
|
REFERENCES:
|
114
|
|
28. The shuffle-left algorithm is
a(n) ____ algorithm in the worst case.
|
a.
|
Θ(1)
|
b.
|
Θ(n)
|
|
c.
|
Θ(2n)
|
d.
|
Θ(n2)
|
ANSWER:
|
d
|
POINTS:
|
1
|
REFERENCES:
|
119
|
|
29. The copy-over algorithm is
____ in time efficiency in the worst case.
|
a.
|
Θ(1)
|
b.
|
Θ(n)
|
|
c.
|
Θ(2n)
|
d.
|
Θ(n2)
|
ANSWER:
|
b
|
POINTS:
|
1
|
REFERENCES:
|
119
|
|
30. The worst case in binary
search occurs ____.
|
a.
|
when the object to be searched is in the middle of the
list
|
|
b.
|
when the object to be searched is at the end of the list
|
|
c.
|
when the object to be searched is at the beginning of
the list
|
|
d.
|
when the object to be searched is not in the list
|
ANSWER:
|
d
|
POINTS:
|
1
|
REFERENCES:
|
128
|
|
31. Binary search does ____ comparisons
in the worst case.
|
a.
|
Θ(1)
|
b.
|
Θ(lg n)
|
|
c.
|
Θ(n)
|
d.
|
Θ(n2)
|
ANSWER:
|
b
|
POINTS:
|
1
|
REFERENCES:
|
128
|
|
32. Θ(lg n), Θ(n) and Θ(n2) are ____ in the amount of
work they do as n increases.
|
a.
|
restricted
|
b.
|
useful
|
|
c.
|
polynomially bounded
|
d.
|
exponential
|
ANSWER:
|
c
|
POINTS:
|
1
|
REFERENCES:
|
132
|
|
33. An ____ algorithm is called an
exponential algorithm.
|
a.
|
Θ(lg n)
|
b.
|
Θ(n)
|
|
c.
|
Θ(n2)
|
d.
|
Θ(2n)
|
ANSWER:
|
d
|
POINTS:
|
1
|
REFERENCES:
|
134
|
|
34. Problems for which no known
polynomial solution algorithm exists are sometimes approached via ____
algorithms.
|
a.
|
alternative
|
b.
|
intractable
|
|
c.
|
polynomial
|
d.
|
approximation
|
ANSWER:
|
d
|
POINTS:
|
1
|
REFERENCES:
|
136
|
|
35. A surprising number of
problems fall into the “____” category.
|
a.
|
suspected intractable
|
b.
|
approximation algorithm
|
|
c.
|
bin-packing
|
d.
|
declared intractable
|
ANSWER:
|
a
|
POINTS:
|
1
|
REFERENCES:
|
136
|
|
36. ____________________ is the
term to describe an algorithm’s careful use of resources.
ANSWER:
|
Efficiency
|
POINTS:
|
1
|
REFERENCES:
|
95
|
|
37. The number of comparisons done
by the selection sort algorithm does not grow at the same rate as the problem
size n,
instead it grows at approximately the ____________________ of that rate.
ANSWER:
|
square
|
POINTS:
|
1
|
REFERENCES:
|
109
|
|
38. The converging-pointers
algorithm is Θ(n)
in the ____________________ case.
ANSWER:
|
worst
|
POINTS:
|
1
|
REFERENCES:
|
122
|
|
39. A(n) ____________________ is a
path through a graph that begins and ends at the same node and goes through
all other nodes exactly once.
ANSWER:
|
Hamiltonian circuit
|
POINTS:
|
1
|
REFERENCES:
|
133
|
|
40. ____________________ problems
are solvable, but the solution algorithms all require so much work as to be
virtually useless.
ANSWER:
|
Intractable
|
POINTS:
|
1
|
REFERENCES:
|
135
|
|
41. What is the definition of
order of magnitude n?
ANSWER:
|
Anything that varies as a constant times n (and whose graph follows the basic shape
of n) is said to be order of
magnitude n.
|
POINTS:
|
1
|
REFERENCES:
|
101
|
TOPICS:
|
Critical Thinking
|
|
42. Explain the sentence: The
selection sort algorithm not only does comparisons; it also does exchanges.
ANSWER:
|
Even if the largest number in the unsorted section of a
list is already at the end of the unsorted section, the selection sort
algorithm exchanges this number with itself. Therefore, the algorithm
does n exchanges, one for each
position in the list to put the correct value in that position. With every
exchange, the marker gets moved. (However, the work contributed by
exchanges and market moving is so much less than the amount contributed by
comparisons that it can be ignored.)
|
POINTS:
|
1
|
REFERENCES:
|
107
|
TOPICS:
|
Critical Thinking
|
|
43. If an algorithm is more time
efficient and less space efficient, what is this called?
ANSWER:
|
This choice is called the time/space trade-off, in which
you gain something by giving up something else.
|
POINTS:
|
1
|
REFERENCES:
|
120
|
TOPICS:
|
Critical Thinking
|
|
44. What is the logarithm of n to
the base 2?
ANSWER:
|
The number of times a number n can be cut in half and
not go below 1
|
POINTS:
|
1
|
REFERENCES:
|
127
|
TOPICS:
|
Critical Thinking
|
|
45. How do you approach problems
for which no known polynomial solution algorithm exists?
ANSWER:
|
Problems for which no known polynomial solution
algorithm exists are sometimes approached via approximation algorithms.
These algorithms don’t solve the problem, but they provide a close
approximation to a solution.
|
POINTS:
|
1
|
REFERENCES:
|
136
|
TOPICS:
|
Critical Thinking
|
|
46. Discuss at length the “people aspect”
of the practical considerations for the development of algorithms. Include
the concepts of program maintenance and ease of understanding in your
response.
ANSWER:
|
The practical considerations for computer science arise
because the algorithms developed are executed in the form of computer
programs running on real computers to solve problems of interest to real
people. With regard to the “people aspect”: A computer program is seldom
written to be used only once to solve a single instance of a problem. It is
written to solve many instances of that problem with many different input
values, just as the sequential search algorithm would be used many times
with different lists of names and different target NAME values. Furthermore, the problem itself
does not usually “stand still.” If the program is successful, people will
want to use it for slightly different versions of the problem, which means
they will want the program slightly enhanced to do more things. Therefore,
after a program is written, it needs to be maintained, both to fix any
errors that are uncovered through repeated usage with different input
values, and to extend the program to meet new requirements. A great deal of
time and money are devoted to program
maintenance. The person who has to modify a program,
either to correct errors or to expand its functionality, often is not the
person who wrote the original program. To make program maintenance as easy
as possible, the algorithm the program uses should be easy to
understand. Ease of
understanding, clarity, “ease of handling”—whatever you want to
call it—is a highly desirable characteristic of an algorithm.
|
POINTS:
|
1
|
REFERENCES:
|
93-94
|
TOPICS:
|
Critical Thinking
|
|
47. Discuss at length the
measurement of the time and space consumed by an algorithm in order to
determine its efficiency.
ANSWER:
|
To determine whether an algorithm is efficient, space
efficiency can be judged by the amount of information the algorithm must
store in the computer’s memory to do its job, in addition to the initial
data on which the algorithm is operating. If it uses only a few extra
memory locations while processing the input data, the algorithm is
relatively space efficient. If the algorithm requires almost as much
additional storage as the input data itself takes up, or even more, then it
is relatively space inefficient. To measure the time efficiency of an
algorithm, consider a sequential search algorithm that looks up a name in a
telephone directory where the names are not arranged in alphabetical order.
How about running the algorithm on a real computer and timing it to see how
many seconds (or maybe what small fraction of a second) it takes to find a
name or announce that the name is not present? The difficulty with this
approach is that there are three factors involved, each of which can affect
the answer to such a degree as to make whatever number of seconds we come
up with rather meaningless.
1. On what computer will we run the algorithm? Shall we use a modest
laptop or a supercomputer capable of doing many trillions of calculations
per second?
2. What telephone book (list of names) will we use: New York City or Yeehaw
Junction, Florida?
3. What name will we try to find? What if we pick a name that happens to be
first in the list? What if it happens to be last in the list?
Simply timing the running of an algorithm is more likely to reflect
machine speed or variations in input data than the efficiency (or lack
thereof) of the algorithm itself. This is not to say that you can’t obtain
meaningful information by timing an algorithm. For example, using the same
input data (searching for Karlenski, say, in the New York City phone book)
and timing the algorithm on different machines gives a comparison of
machine speeds because the task is identical. Using the same machine and
the same list of names, but searching for different names, gives an
indication of how the choice of NAME affects the
algorithm’s running time on that particular machine. This type of
comparative timing is called benchmarking. Benchmarks are useful for rating
one machine against another and for rating how sensitive a particular
algorithm is with respect to variations in input on one particular machine.
However, what we mean by an algorithm’s time efficiency is an indication of
the amount of “work” required by the algorithm itself. It is a measure of
the inherent efficiency of the method, independent of the speed of the
machine on which it executes or the specific input data being processed. Is
the amount of work an algorithm does the same as the number of instructions
it executes? Not all instructions do the same things, so perhaps they
should not all be “counted” equally. Some instructions are carrying out
work that is fundamental to the way the algorithm operates, whereas other
instructions are carrying out peripheral tasks that must be done in support
of the fundamental work. To measure time efficiency, we identify the
fundamental unit (or units) of work of an algorithm and count how many
times the work unit is executed.
|
POINTS:
|
1
|
REFERENCES:
|
95-96
|
TOPICS:
|
Critical Thinking
|
|
48. Given the data cleanup problem
described in the text, write the pseudocode for the converging-pointers
algorithm for data cleanup.
ANSWER:
|
1. Get values for n and
the n data items
2. Set the value of legit to n
3. Set the value of left to 1
4. Set the value of right to n
5. While left is less than right do Steps 6 through 10
6. If the item at position left is not 0 then increase left by 1
7. Else (the item at position left is 0) do Steps 8 through 10
8. Reduce legit by 1
9. Copy the item at position right into position left
10. Reduce right by 1
11. If the item at position left is 0, then reduce legit by 1
12. Stop
|
POINTS:
|
1
|
REFERENCES:
|
121
|
TOPICS:
|
Critical Thinking
|
|
49. Explain the term “brute force”
as it applies to algorithms.
ANSWER:
|
The algorithm described here for testing an arbitrary
graph for Hamiltonian circuits is an example of a brute force
algorithm—one that
beats the problem into submission by trying all possibilities. In Chapter
1, we described a brute force algorithm for winning a chess game; it
consisted of looking at all possible game scenarios from any given
point on and then picking a winning one. This is also an exponential
algorithm. Some very practical problems have exponential solution
algorithms. For example, an email message that you send over the
Internet is routed along the shortest possible path through
intermediate computers from your mail server computer to the
destination mail server computer. An exponential algorithm to solve
this problem would examine all possible paths to the destination
and then use the shortest one. As you can imagine, the Internet uses a
better (more efficient) algorithm than this one!
|
POINTS:
|
1
|
REFERENCES:
|
135
|
TOPICS:
|
Critical Thinking
|
|
50. Discuss at length both the
best and worst case of the pattern-matching algorithm.
ANSWER:
|
Both the best case and the worst case of this algorithm
can occur when the pattern is not in the text at all. The difference hinges
on exactly how the
pattern fails to be in the text. The best case occurs if the first
character of the pattern is nowhere in the text, as in
Text: KLMNPQRSTX
Pattern: ABC
In this case, n – m + 1
comparisons are required, trying (unsuccessfully) to match P1
with T1, T2, . . . , Tn–m+1
in turn. Each comparison fails, and the algorithm slides the pattern
forward to try again at the next position in the text. The maximum amount
of work is done if the pattern almost occurs
everywhere in the text. Consider, for example, the following case:
Text: AAAAAAAAA
Pattern: AAAB
Starting with T1, the first text character, the match
with the first pattern character is successful. The match with the second
text character and the second pattern character is also successful.
Indeed m – 1 characters of the pattern match with the
text before the mth comparison proves a failure. The process
starts over from the second text character, T2. Once
again, m comparisons are required to find a mismatch.
Altogether, m comparisons are required for each of
the n – m + 1 starting positions in
the text. Another version of the worst case occurs when the pattern is
found at each location in the text, as in
Text: AAAAAAAAA
Pattern: AAAA
This results in the same comparisons that are done for the other worst
case. The only difference is that the comparison of the last pattern
character is successful.
|
POINTS:
|
1
|
REFERENCES:
|
130-131
|
TOPICS:
|
Critical Thinking
|
|
Chapter_05_Computer_Systems_Organization
1. The branch of computer science that studies computers
in terms of their major functional units and how they work is known as
computer organization.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
222
|
|
2. Both RAM and ROM are memory
chips into which information has been prerecorded during manufacture.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
226
|
|
3. Memory locations are stored in
row major order.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
232
|
|
4. As computers become faster,
memory access speeds are keeping pace.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
235
|
|
5. The principle of locality
states that when the computer uses something, it will probably use it again
very soon.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
236
|
|
6. In a two-level memory
hierarchy, when the computer needs a piece of information, it looks in RAM
first, then cache memory.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
237
|
|
7. Registers can be accessed much
more quickly than random access memory.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
245
|
|
8. The instructions that can be
decoded and executed by the control unit of a computer are represented in
machine language.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
250
|
|
9. The set of all operations that
can be executed by a processor is called its I/O set.
ANSWER:
|
False
|
POINTS:
|
1
|
REFERENCES:
|
251
|
|
10. The Von Neumann bottleneck is
the inability of the sequential one-instruction-at-a-time computer Von
Neumann model to handle today’s large-scale problems.
ANSWER:
|
True
|
POINTS:
|
1
|
REFERENCES:
|
267
|
|
Comments
Post a Comment