CPSA-FL practice question 8 of 10

Which of the following statements are correct? (Choose two.)

Full set: 43 questions
Answer options
A: The push operation usually places a new element onto a stack. Correct answer
B: A stack acts exactly like a queue.
C: A stack is organized according to the FIFO principle.
D: A stack usually only provides access to one element at a time. Correct answer
Correct Answer:
A. The push operation usually places a new element onto a stack.; D. A stack usually only provides access to one element at a time.
Explanation

A stack is a fundamental abstract data type that operates on the Last-In, First-Out (LIFO) principle. The push operation is the standard method for adding a new element to the top of the stack. Because of its LIFO nature, operations such as adding (push), removing (pop), or viewing (peek) are restricted to the most recently added element, which is at the top. Consequently, a stack typically provides direct access to only one element at a time—the top one. To access deeper elements, the elements above them must be removed first.

Why Incorrect

B. A stack (LIFO) and a queue (FIFO) are distinct data structures with opposite principles of element access and removal.
C. The FIFO (First-In, First-Out) principle describes the behavior of a queue, not a stack, which is LIFO (Last-In, First-Out).

References

1. International Software Architecture Qualification Board (iSAQB). (2023). Curriculum for Certified Professional for Software Architecture - Foundation Level (CPSA-F)

Version 2.2EN. Section 2.3.2

"Data Structures

" describes a stack as a data structure organized according to the LIFO principle.

2. Cormen

T. H.

Leiserson

C. E.

Rivest

R. L.

& Stein

C. (2009). Introduction to Algorithms (3rd ed.). MIT Press. In Chapter 10

Section 10.1

"Stacks and queues

" a stack is defined as implementing a last-in

first-out (LIFO) policy. The PUSH operation is described as inserting an element onto the stack

and access is limited to the element at the "top."

3. Demaine

E. (2011). 6.006 Introduction to Algorithms

Fall 2011. Massachusetts Institute of Technology: MIT OpenCourseWare. Lecture 3

"Stacks

Queues

Linked Lists

" defines a stack with push(x) and pop() operations acting on the top of the stack

enforcing LIFO behavior. It explicitly contrasts this with the FIFO behavior of a queue.

Scroll to Top