1.If a series of characters are put into a stack and then output to the screen a
ID: 3861062 • Letter: 1
Question
1.If a series of characters are put into a stack and then output to the screen as they come out they will appear a. The first followed by the last, etc until all have been removed b. In reverse order from how they went in the stack c. Just as they were when they went in d. Scrambled into a random order
2.The iterator for an STL stack a. Starts at the bottom and comes to the top b. Returns the top item c. Starts at the top and goes to the bottom d. The stack has no iterator
3.When checking to see if ()'s and {}'s are correct in code we a. Should use four stacks, one for each character we're tracking. b. Could use two counters, but a stack is more efficient c. Use a stack because each ( will be matched with the correct ) and each { will be matched with the correct } d. Should use the isop function because it contains a stack
Explanation / Answer
QUESTION 1:
Answer: (b)
Explanation: STACK is a LIFO. Last in First Out
QUESTION 2:
Answer: (d)
Explanation: By definition the STL stack does not have iterator. If you need a iterator you will have to implement it yourself on top of other container.
QUESTION 3:
Answer: (c)
Explanation: This link has a algorothm Need to apply logic for your solution. http://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.