Data Structures: Stacks — Chapter Test

Answer all 5 questions, then submit. You need 60% to pass. Log in to save progress.

Question 1
A stack follows which principle?
AFIFO (First In First Out)
BLIFO (Last In First Out)
CRandom access
DSorted order
Question 2
Which Python list method performs a PUSH onto a stack?
Ainsert(0, x)
Bappend(x)
Cpop()
Dremove(x)
Question 3
Trying to pop from an empty stack causes…
AOverflow
BUnderflow
CA push
DNothing
Question 4
How do you peek at the top item of a list-based stack without removing it?
Astack[0]
Bstack[-1]
Cstack.pop()
Dstack.top()
Question 5
Which is a real-world example of a stack?
AA queue at a ticket counter
BThe browser Back button / Undo
CA dictionary lookup
DA sorted list