1 1 vote Consider a function modify $(\mathrm{Q})$ that uses a single temporary stack $\mathrm{S}$ to process a queue $\mathrm{Q}$. Initially, $\mathrm{Q}$ contains the elements: $\mathrm{Q}=[10,20,30,40]$ (with $10$ at the $\text{FRONT}$).The $\mathrm{modify(Q)}$ function executes the following steps:While $\mathrm{Q}$ is not empty: $\text{DEQUEUE}$ element from $\mathrm{Q}$ and PUSH onto $\mathrm{S}$. While $\mathrm{S}$ is not empty: $\text{POP}$ element from $\mathrm{S}$ and ENQUEUE back into $\mathrm{Q}$.What will be the elements of $\mathrm{Q}$ after the function modify $\mathrm{(Q)}$ completes?$[10,20,30,40]$ (Unchanged) $[40,30,20,10]$ (Reversed) $[20,30,40,10]$ (Rotated) $[10,40,30,20]$ (Partially Reversed) Programming in C goclasses python-&-dsa goclasses-da-dpp goclasses-da-dpp-day-68 goclasses-python-&-dsa-practice-questions + – GO Classes 272 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
2 2 votes $\text{modify(Q)}$ reverses the queue. Hence B is correct. GO Classes answered Dec 16, 2025 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.