A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

Important Notice!

Dear users, compscibits.com is now permanently moved to compsciedu.com. Please update all your links and bookmarks accordingly. Soon, the site will be accessible through URL compsciedu.com only.

Discussion Forum

Que. Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:

i. isEmpty (Q) — returns true if the queue is empty, false otherwise.
ii. delete (Q) — deletes the element at the front of the queue and returns its value.
iii. insert (Q, i) — inserts the integer i at the rear of the queue.
Consider the following function:

void f (queue Q) {
int i ;
if (!isEmpty(Q)) {
i = delete(Q);
insert(Q, i);

What operation is performed by the above function f ?
a. Leaves the queue Q unchanged
b. Reverses the order of the elements in the queue Q
c. Deletes the element at the front of the queue Q and inserts it at the rear keeping the other elements in the same order
d. Empties the queue Q
Answer:Reverses the order of the elements in the queue Q
Confused About the Answer? Ask for Details Here
Know Explanation? Add it Here

Similar Questions: