In C++ Standard Library terminology, which of the following is a sequence…

2022

In C++ Standard Library terminology, which of the following is a sequence container rather than a container adaptor?

Answer: B. dequeConceptThe C++ Standard Library distinguishes containers, which store elements themselves, from container adaptors, which expose a restricted interface over…

  1. A.

    queue

  2. B.

    deque

  3. C.

    priority_queue

  4. D.

    stack

Attempted by 218 students.

Show answer & explanation

Correct answer: B

Concept

The C++ Standard Library distinguishes containers, which store elements themselves, from container adaptors, which expose a restricted interface over an underlying container. The term “adaptor” describes this wrapper interface; it does not require C++ class inheritance.

Application

  • queue is a container adaptor with FIFO access; its default underlying container is deque.

  • deque is a sequence container that stores its own elements, supports random access, and permits insertion or removal at both ends.

  • priority_queue is a container adaptor whose default underlying container is vector and whose interface maintains heap ordering.

  • stack is a container adaptor with LIFO access; its default underlying container is deque.

Cross-check

The standard container taxonomy lists deque among sequence containers, while stack, queue, and priority_queue are container adaptors. Therefore, deque is the sequence container and is the intended answer.

Explore the full course: Dsssb Tgt Computer Science Paper 2

Loading lesson…