Assume q1 and q2 implement a stack, with pop transferring queued elements…
BPSC TRE · TRE 1.0 · PGT (Classes 11–12) · Computer Science · 26 Aug 2023 · Shift 2 · SubjectModified — slightly modified from the official paper; see the solution
Assume q1 and q2 implement a stack, with pop transferring queued elements between them. What is the functionality of the following piece of code? public void fun(int x) { q1.offer(x); }
- A.
Perform push( ) with push as the costlier operation
- B.
Perform push( ) with pop as the costlier operation
- C.
Perform pop( ) with push as the costlier operation
- D.
More than one of the above
- E.
None of the above
Attempted by 63 students.
Sign up free to check your answer
Sign up freeLoading lesson…