In a stack implementation that uses one or more queues, fun(int x) is the push…

PYQ Capgemini Hiring Assessment 2024

In a stack implementation that uses one or more queues, fun(int x) is the push operation shown below:

public void fun(int x)
{
    q1.offer(x);
}

Which implementation strategy does this method represent?

  1. A.

    A push operation in which push is the costlier operation

  2. B.

    A push operation in which pop is the costlier operation

  3. C.

    A pop operation in which push is the costlier operation

  4. D.

    A pop operation in which pop is the costlier operation

Attempted by 150 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…