CBSE Class 12

Computer Science

03 Stack

30
Total
0
Attempted
0
Correct
0
Wrong
00:00:00
Q-1
Consider the following Python code implementing a stack using a list. What will be printed?
Medium Implementation of Stack in Python
Reference Code
```python
stack = []
stack.append(10)
stack.append(20)
stack.append(30)
print(stack.pop(), stack)
A 30 [10, 20]
B 20 [10, 30]
C 30 [10, 20, 30]
D 10 [20, 30]
Answer: 30 [10, 20]
Explanation: pop() removes and returns the top element (30), leaving [10,20].