Skip to main contentSkip to solution

Python built in functions ___________ and _____________ of list can be used to implement PUSH and POP respectively in a stack.

Solution

✅ Correct Option: 4

A stack works on the LIFO (last in, first out) principle, so both operations happen at the end of the list. append(x)append(x) adds an element at the end, which is PUSH. pop()pop() removes and returns the last element, which is POP.

For example, st = [], then st.append(10) pushes 10, and st.pop() removes it.


Option 3: Python lists have no built-in pushpush method; appendappend does that job.

Options 1 and 2: deletedelete is not a list method (del is a statement, not a function of list), and insertinsert needs an index, so it is not the standard PUSH.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question