## Queue

#### Quiz-summary

0 of 10 questions completed

Questions:

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10

#### Information

Queue

You have already completed the quiz before. Hence you can not start it again.

Quiz is loading...

You must sign in or sign up to start the quiz.

You have to finish following quiz, to start this quiz:

#### Results

0 of 10 questions answered correctly

Your time:

Time has elapsed

You have reached 0 of 0 points, (0)

#### Categories

- Not categorized 0%

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10

- Answered
- Review

- Question 1 of 10
##### 1. Question

What does the above function do in general?

CorrectIncorrect - Question 2 of 10
##### 2. Question

Which one of the following is an application of Queue Data Structure?

CorrectIncorrect - Question 3 of 10
##### 3. Question

Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are

CorrectIncorrect - Question 4 of 10
##### 4. Question

A priority queue can efficiently implemented using which of the following data structures? Assume that the number of insert and peek (operation to see the current highest priority item) and extraction (remove the highest priority item) operations are almost same.

CorrectIncorrect - Question 5 of 10
##### 5. Question

A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is given below: 10, 8, 5, 3, 2 Two new elements ”1‘ and ”7‘ are inserted in the heap in that order. The level-order traversal of the heap after the insertion of the elements is:

CorrectIncorrect - Question 6 of 10
##### 6. Question

Consider the following pseudo code. Assume that IntQueue is an integer queue. What does the function fun do?

void fun(int n)

{

IntQueue q = new IntQueue();

q.enqueue(0);

q.enqueue(1);

for (int i = 0; i < n; i++) { int a = q.dequeue(); int b = q.dequeue(); q.enqueue(b); q.enqueue(a + b); ptint(a); } }CorrectIncorrect - Question 7 of 10
##### 7. Question

Which of the following name does not relate to stacks?

CorrectIncorrect - Question 8 of 10
##### 8. Question

Suppose implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?

CorrectIncorrect - Question 9 of 10
##### 9. Question

Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter.

MultiDequeue(Q){

m = k

while (Q is not empty and m > 0) {

Dequeue(Q)

m = m – 1

}

}

What is the worst case time complexity of a sequence of n MultiDequeue() operations on an initially empty queue? (GATE CS 2013)

(A) \Theta(n)

(B) \Theta(n + k)

(C) \Theta(nk)

(D) \Theta(n^2)CorrectIncorrect - Question 10 of 10
##### 10. Question

Consider the following pseudo code. Assume that IntQueue is an integer queue. What does the function fun do?

void fun(int n)

{

IntQueue q = new IntQueue();

q.enqueue(0);

q.enqueue(1);

for (int i = 0; i < n; i++) { int a = q.dequeue(); int b = q.dequeue(); q.enqueue(b); q.enqueue(a + b); ptint(a); } }CorrectIncorrect