nerdexam
Python_Institute

PCEP-30-02 · Question #13

An alternative name for a data structure called a stack is:

The correct answer is A. LIFO. A stack is called a LIFO (Last In, First Out) structure because the last element added is always the first one removed - like a stack of plates where you take from the top. B (FIFO) - "First In, First Out" - describes a queue, not a stack; think of a line at a checkout where…

Question

An alternative name for a data structure called a stack is:

Options

  • ALIFO
  • BFIFO
  • CFOLO
  • DFIDO

How the community answered

(66 responses)
  • A
    73% (48)
  • B
    5% (3)
  • C
    9% (6)
  • D
    14% (9)

Explanation

A stack is called a LIFO (Last In, First Out) structure because the last element added is always the first one removed - like a stack of plates where you take from the top.

B (FIFO) - "First In, First Out" - describes a queue, not a stack; think of a line at a checkout where the first person in is the first served.

C (FOLO) and D (FIDO) are nonsense acronyms that don't correspond to any real data structure terminology.

Memory tip: Think of a stack of pancakes - you always eat (remove) from the top, which is the last one added. "Last pancake on, first pancake eaten" = LIFO.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice