KnowledgeBoat Logo

Computer Science

Assertion (A): Stack is a memory structure that works on the principle of FIFO (First In, First Out).

Reasoning (R): Stack is implemented using list and allows to add an element using append() method.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Stack

1 Like

Answer

A is false but R is true.

Explanation
A stack is a memory structure that works on the principle of LIFO (Last In, First Out), meaning that the last element added to the stack is the first one to be removed. In Python, a stack can be implemented using a list data structure, and the "append()" method is used to add elements to the top of the stack.

Answered By

3 Likes


Related Questions