Data Abstraction and Problem Solving with Java Walls and Mirrors 3rd Edition Prichard Test Bankpdf download
Data Abstraction and Problem Solving with Java Walls and Mirrors 3rd Edition Prichard Test Bankpdf download
https://testbankdeal.com/product/data-abstraction-and-problem-
solving-with-java-walls-and-mirrors-3rd-edition-prichard-test-
bank/
https://testbankdeal.com/product/data-abstraction-and-problem-solving-
with-c-walls-and-mirrors-6th-edition-carrano-test-bank/
https://testbankdeal.com/product/data-abstraction-and-problem-solving-
with-c-walls-and-mirrors-7th-edition-carrano-test-bank/
https://testbankdeal.com/product/data-abstraction-and-problem-solving-
with-c-walls-and-mirrors-6th-edition-carrano-solutions-manual/
https://testbankdeal.com/product/handbook-of-informatics-for-nurses-
and-healthcare-professionals-5th-edition-hebda-test-bank/
Business Statistics For Contemporary Decision Making 8th
Edition Black Test Bank
https://testbankdeal.com/product/business-statistics-for-contemporary-
decision-making-8th-edition-black-test-bank/
https://testbankdeal.com/product/college-accounting-14th-edition-
price-solutions-manual/
https://testbankdeal.com/product/managerial-accounting-decision-
making-and-motivating-performance-1st-edition-datar-solutions-manual/
https://testbankdeal.com/product/animal-diversity-7th-edition-hickman-
solutions-manual/
https://testbankdeal.com/product/busn-9th-edition-kelly-test-bank/
Personal Finance Canadian Canadian 6th Edition Kapoor Test
Bank
https://testbankdeal.com/product/personal-finance-canadian-
canadian-6th-edition-kapoor-test-bank/
Chapter 7: Stacks
2) If the array:
6, 2, 7, 13, 5, 4
is added to a stack, in the order given, which number will be the first number to be removed from the stack?
a) 6
b) 2
c) 5
d) 4
Answer: d.
3) The item that is removed first from a stack is called the ______ of the stack.
a) front
b) top
c) base
d) prime
Answer: b.
4) If the array:
6, 21, 35, 3, 6, 2, 13
is added to a stack, in the order given, which of the following is the top of the stack?
a) 2
b) 6
c) 3
d) 13
e) 35
Answer: d.
5) If the array:
6, 2, 7, 13, 5, 4
is added to a queue, in the order given, which number will be the first number to be removed from the queue?
a) 6
b) 2
c) 5
d) 4
Answer: a.
8) The ______ method of the ADT stack adds an item to the top of the stack.
a) createStack
b) push
c) pop
d) peek
Answer: b.
9) The ______ method of the ADT stack retrieves and then removes the top of the stack.
a) createStack
b) push
c) pop
d) peek
Answer: c.
10) The ______ method of the ADT stack retrieves the top of the stack, but does not change the stack.
a) createStack
b) push
c) pop
d) peek
Answer: d.
11) Which of the following methods of the ADT stack accepts a parameter?
a) push
b) pop
c) createStack
d) peek
Answer: a.
13) If a stack is used by an algorithm to check for balanced braces, which of the following is true once the end of
the string is reached?
a) the stack is empty
b) the stack has one “{”
c) the stack has one “}”
d) the stack has one “{” and one “}”
Answer: a.
14) Which of the following operations of the ADT stack does not throw a StackException?
a) push
b) pop
c) popAll
d) peek
Answer: c.
15) The pop operation throws a StackException when it tries to ______.
a) add an item to an empty stack
b) add an item to an array-based implementation of a stack that is already full
c) delete an item from an array-based implementation of a stack that is already full
d) delete an item from an empty stack
Answer: d.
18) In the StackInterface class, the pop method returns an item that is an instance of ______.
a) Integer
b) Double
c) String
d) Object
Answer: d.
19) In the StackInterface class, the push method accepts as its parameter an item that is an instance of
______.
a) Integer
b) Double
c) String
d) Object
Answer: d.
21) Which of the following is NOT true about converting infix expressions to postfix expressions?
a) the operands always stay in the same order with respect to one another
b) the operators always stay in the same order with respect to one another
c) an operator will move only “to the right” with respect to the operands
d) all parentheses are removed
Answer: b.
22) Which of the following is the postfix form of the infix expression: (a + b) * c / d
a) a b + c * d /
b) a b * c / d +
c) a + b * c / d
d) a b + c d * /
Answer: a.
24) In a graph that represents the flight map for the HPAir problem, if a flight exists from city C 1 to city C2, then C2
is said to be ______ C1.
a) adjacent to
b) similar to
c) related to
d) bordering
Answer: a.
25) In a graph that represents the flight map for the HPAir problem, if a flight exists from city C 1 to city C2, then the
path from C1 to C2 is called a _______.
a) relation
b) neighborhood
c) directed path
d) connecting path
Answer: c.
26) ______ are considered when choosing the next city to visit in a stack-based nonrecursive solution to the HPAir
problem.
a) All cities
b) All unvisited cities adjacent to the destination city
c) All cities adjacent to the city on the top of the stack
d) All unvisited cities adjacent to the city on the top of the stack
Answer: d.
27) An algorithm that uses a stack to implement a nonrecursive solution to the HPAir problem reaches the
conclusion that there is no path from an origin city to a destination city only after ______.
a) the algorithm has backtracked to the origin
b) the algorithm has backtracked to the origin and there remain no unvisited cities to fly to from the
origin
c) the algorithm has reached a city and there remain no unvisited cities to fly to from that city
d) the algorithm has reached the destination and there remain no unvisited cities to fly to from the
destination
Answer: b.
28) Which of the following methods is NOT called by the nonrecursive stack version of the isPath method?
a) insertAdjacent
b) unvisitAll
c) markVisited
d) getNextCity
Answer: a.
29) Typically, ______ are used by a compiler to implement recursive methods.
a) linked-lists
b) arrays
c) stacks
d) queues
Answer: c.
30) When a recursive call to a method occurs, the compiler’s implementation must remember all of the following
information EXCEPT ______.
a) values of parameters
b) values of local variables
c) values of global variables
d) a reference to the point from which the recursive call was made
Answer: c.
True/False Questions:
1) If 5 items are added to a stack, the first item to be removed from the stack is the first item that was added to
the stack.
Answer: False.
4) A program can use the operations of the ADT stack without knowing how the operations are implemented.
Answer: True.
7) In a reference-based implementation of a stack, it is necessary to call the isFull method before calling
the push method.
Answer: False.
9) In a reference-based implementation of a stack, the stack can grow and shrink dynamically.
Answer: True.
10) When infix expressions are converted to postfix expressions, the operands always stay in the same order
with respect to one another.
Answer: True.
Short Answer Questions:
3) What is the difference between the stack pop and peek operations?
Answer: The pop operation retrieves and then removes the top of the stack. The peek operation retrieves the top of
the stack, but does not remove it.
4) Write the axiom for specifying that the last item inserted into a stack is the first item to be removed.
Answer: (stack.push(newItem)).pop() = stack
5) How can the condition, when you reach the end of the string, you have matched each “{”, be verified in a
program that uses a stack to check for balanced braces?
Answer: This condition can be verified by checking if the stack is empty when the end of the string is reached.
8) What is the restriction that the array-based implementation of a stack places on the push operation?
Answer: The restriction that is placed by the array-based implementation of a stack is that it prevents the push
operation from adding an item to the stack if the stack’s size limit, which is the size of the array, has been reached.
9) What is the advantage of an implementation of a stack that uses the ADT list over an implementation that
uses a linked list?
Answer: The advantage of an implementation that uses the ADT list is that this approach is much simpler to write
than an implementation that uses a linked list.
10) What are the three facts about converting from infix expressions to postfix expressions?
Answer: The three facts are:
• The operands always stay in the same order with respect to one another.
• An operator will move only “to the right” with respect to the operands.
• All parentheses are removed.
11) What are the factors which determine the placement of operators when an infix expression is converted to a
postfix expression?
Answer: The factors which determine the placement of operators are parentheses, operator precedence, and left-to-
right association.
14) If a stack is used in a nonrecursive solution to the HPAir problem, when is it necessary to backtrack from a
city?
Answer: It is necessary to backtrack from a city whenever there are no more unvisited cities to fly to from that city.
16) Explain how a stack can be used to determine if an infix expression is correctly parenthesized.
Answer: Each time we read a ‘(‘ character, we push it on the stack. Each time we read a ‘)’ character, we perform a
pop. Other characters in the expression are ignored. If, while reading the expression, we try to pop an
empty stack, we halt and reject the input string. Otherwise, once we are finished reading the expression,
we check to see if the stack is empty. If it is, the expression is good; otherwise it is not.
17) Suppose we begin with an empty stack, and perform the following operations: push 7, push 2, push 9, push
6, pop, pop, peek, push 1, push 3, peek, push 8, pop, peek, pop, pop, push 5, push 4, pop, pop, pop, push 8.
What is contained on the stack when we are done? Write out the contents from top to bottom.
Answer: Just 2 values in the stack: 8 on top, 7 on bottom.
18) Why does the ADT stack not define a get( ) method?
Answer: The philosophy of the stack is that we are only interested in the “top” of the stack: which value was most
recently added. Stacks are used in applications where we would never be interested in retrieving an
arbitrary element from the interior of the collection.
19) Describe an example of a game in which the logic of the game makes use of a stack.
Answer: (Many possible answers) In gin rummy, when a player discards, the card goes on top of a stack of discards.
Cards underneath are concealed by the one on top. A similar situation occurs in solitaire, where the player
can deal cards, and any cards that are not able to be played go onto a stack.
20) Suppose an infix expression contains parentheses as grouping symbols. Is it still possible to convert this
expression into postfix notation?
Answer: Yes. The algorithm takes parentheses into account.
Other documents randomly have
different content
part is below sea level and therefore flooded by the marine waters of
Puget Sound. The most prominent feature of this area is Puget
Sound. This is a glacially-carved and drowned river valley, studded
with islands, peninsulas, fjords and bays that all possess a general
north-south orientation resulting from the direction of ice movement.
Puget Sound is connected with the Pacific Ocean by the Strait of
Juan De Fuca, a wide channel separating the state of Washington
and Vancouver Island.
The San Juan Islands represent the glaciated remnants of mountains
that, in preglacial time, may have connected the mountains on
Vancouver Island with the Cascades of Washington. The San Juan
Islands lie at the junction of Puget Sound, the Strait of Georgia, and
the Strait of Juan De Fuca. As a result of a boundary dispute and
subsequent arbitration, the islands were apportioned, on the basis of
the deepest channel separating them, between Canada and the
United States. The American portion includes more than 400 islands.
These vary in size from mere rocks above high tide to Orcas Island,
60 square miles in area.
The Olympic Peninsula, or Olympic Province, lies between Puget
Sound and the Pacific Ocean. The Strait of Juan De Fuca separates
this peninsula from Vancouver Island on the north. In the south the
valley of the Chehalis River is a convenient boundary for the
province. The central portion of the peninsula is occupied by the
Olympic Mountain Range. This range is nearly oblong in shape,
measuring some 70 miles east to west by 45 miles north to south.
The mountains are extremely rough and jagged. They rise from sea
level to above 6,000 feet. The highest peak, Mount Olympus, is
8,150 feet in elevation.
South of the Olympic Province and west of the Puget Sound Trough
is an area of low, rough hills. Culver called it the Willapa Hills
Province.
The northern third of the land east of the Cascade Mountains, or
northeastern Washington, is termed the Okanogan Highland
Province by Culver. Its southern boundary is set at the east-west
flow of the Spokane and Columbia rivers. The outstanding
physiographic feature of this area is its division into north-south
trending areas of lowland with intervening highlands and mountain
ranges. The rivers are, from east to west, the Clark Fork, Colville,
Columbia, Kettle, San Poil and Okanogan. Not all intervening
highlands are separately designated as mountains. Among these
named are the Pend Oreille, Huckleberry, Kettle River, and Okanogan
ranges.
The part of eastern Washington south of the Okanogan Highland
Province, save the extreme southeastern corner of the state,
constitutes the Columbia Lava Province. This is an extensive,
relatively level plateau that lies mainly below 2,000 feet elevation.
The plateau consists of gently folded lava flows that reach a depth of
4,000 feet in some places (Russell, 1893) and slope inward from the
east, north, and, in part, the west (Flint, 1938). These horizontal
layers of basalt are extremely resistant to erosion by other than
large rivers. Two great gashes cross the Plateau diagonally from the
northeast to the southwest; these are Moses Coulee and the Grand
Coulee. These old coulees are the former valleys of the Columbia
River, and were formed at the time when the course of the river was
successively blocked by the advance of Pleistocene ice. The Snake
River crosses the southern edge of the Columbia Lava Province and
separates the plateau proper from an area of similar land to the
southward.
Fig. 2. Columbia River one mile west of Kellers
Ferry, Washington, elevation 1,060 feet, April 16,
1940. (Fish and Wildlife Service photo by Victor
B. Scheffer, No. 933.)
{ Cascade Mountains
Cascade Mountains
{ Yakima Valley
Puget Sound }
Willapa Hills } Western Washington
Olympic Mountains }
Okanogan Highlands Northeastern Washington
{ Columbian Plateau
Columbia Lava
{ Southeastern Washington
Blue Mountains Blue Mountains
CLIMATE AND VEGETATION
The life-zone theory of plant and animal distribution was proposed
by Merriam (1892). Merriam's life-zones have been severely criticized
by many authors, especially because an error was made in
computing some of the data on temperature. However, zonation of
vegetation and animals is obvious in Washington, and the life-zone
concept has been employed in Washington by numerous botanists
and zoölogists. Among them are: Piper (1906), Taylor and Shaw
(1927), Jones (1936, 1938) and St. John (1937).
The higher parts of the Cascade Mountains are in the Arctic-alpine
Life-zone. This is the area of wind-swept ridges, living glaciers, and
permanent snow fields.
Trees are absent but a few shrubs are present; these include:
Juniperus sibirica, Salix cascadensis, Salix nivalis, Gaultheria
humifusa, Empetrum nigrum, and the heathers, Phyllodoce
glanduliflora, Cassiope mertensiana and Cassiope stelleriana. Jones
(1938) lists a total of 98 species of plants from the Arctic-alpine Life-
zone of Mount Rainier. Many of these plants are most abundant in
the next life-zone lower, and are of but incidental occurrence in the
Arctic-alpine Life-zone. No mammalian species is resident but
individuals of several species regularly visit and occasionally breed
there.
Below the Arctic-alpine the Hudsonian Life-zone stretches the entire
length of the Cascades. Temperatures are low, especially in winter;
then the thermometer does not rise above zero for weeks at a time.
The average annual temperature at Paradise, 5500 feet, Mt. Rainier,
is 38.6° (all temperatures given here are in degrees Fahrenheit).
Snowfall is heavy. The average yearly snowfall, for four years, at Mt.
Baker Lodge, at 4200 feet elevation, Whatcom County, was 478
inches; at Goat Lake, 2900 feet, Snohomish County, 261 inches; Tye,
Stevens Pass, 3010 feet, King County, 398 inches; Paradise, 5500
feet, Mt. Rainier, 587 inches. The deepest snow recorded at Paradise
was 27 feet, 2 inches on April 2, 1917. Following the spring thaws
the mountain passes are opened to travel, usually in April or May,
although nightly temperatures in April and May are still below zero.
Spring precipitation is heavy, the monthly average for a twelve-year
period at Paradise being 6.78 inches in April and 5.5 inches in May.
Summer temperatures are high in the daytime, when the sun beats
down through the rarefied atmosphere, but cool at night when
accumulated heat is lost through the thin atmospheric blanket. In
summer precipitation is light, averaging, at Paradise, 3.46 inches in
June, .9 inches in July, and 3.44 inches in August. In the autumn the
temperature, both daily and nightly, drops somewhat, and rain and
cloudiness are the rule. At Paradise the average precipitation in
September is 8.29 inches and in October 10.02 inches. The winter
snows usually arrive by the middle of November.
Fig. 8. North side of Mount Rainier, 14,408 feet,
with Mount Adams at left and Mount St. Helens
at right. June 19, 1932. (Photo by 116th Photo
Section, Washington National Guard, No. 011-
36A-116.)
testbankdeal.com