Exercises Stacks True or False? A stack is a first in, first out structure. The
ID: 3528400 • Letter: E
Question
Exercises Stacks True or False? A stack is a first in, first out structure. The item that has been in a stack the longest is at the "bottom" of the stack. If you push five items onto an empty stack and then pop the stack five times, the stack will be empty again. The push operation should be classified as a "transformer." The top operation should be classified as a "transformer." The pop operation should be classified as an "observer." If we first push itemA onto a stack and then push itemB, then the top of the stack is itemB.Explanation / Answer
a. false . // stack is last in ,first out structure
b. true .
c. true. // because pop will pop out the top element.
d. false. // because top will only give the top element and it does not modify the stack .
e. true. // because it changes the stack.
f. false. // because top wont change the stack , it should be observer.
g. false. // because it changes the stack structure, it should be transformer
h. true. // becuase last in item will be on top.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.