Ds Quiz 4 Cse D

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Ashishjn.mecs1
A
Ashishjn.mecs1
Community Contributor
Quizzes Created: 1 | Total Attempts: 163
| Attempts: 163 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. If the MAX_SIZE is the size of the array used in the implementation of circular queue. How is rear manipulated while inserting an element in the queue? 

Explanation

The correct answer is Rear=(Rear+1)%MAX_SIZE. This is because when inserting an element in a circular queue, the rear pointer needs to be incremented to point to the next available position in the queue. However, if the rear pointer reaches the end of the array (MAX_SIZE), it needs to wrap around to the beginning of the array. The expression (Rear+1)%MAX_SIZE achieves this by incrementing the rear pointer by 1 and then taking the modulus of MAX_SIZE to ensure it stays within the bounds of the array.

Submit
Please wait...
About This Quiz
Ds Quiz 4 Cse D - Quiz

DS QUIZ 4 CSE D assesses knowledge on circular queues, priority queues, and queue configurations. It tests the understanding of queue operations, conditions for full or empty queues, and priority queue representations, essential for computer science students.

Personalize your quiz and earn a certificate with your name on it!
2. Which of the following is a collection of items into which items can be inserted arbitrarily and from which only the smallest item can be removed?

Explanation

An increasing order priority queue is a collection of items where items can be inserted arbitrarily, but only the smallest item can be removed. This means that when inserting items into the priority queue, they are arranged in increasing order based on their priority. The item with the highest priority (smallest value) will always be at the front of the queue and can be removed. Other items can only be removed once they reach the front of the queue and become the smallest item.

Submit
3. Suppose a circular queue of capacity 10 elements is implemented with an array of dimension 10. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, FRONT = 1 and REAR = 5 
 ABCDE    
What will be position of FRONT and REAR, after performing the following operations on the queue?ADD F, DELETE TWO LETTERS, ADD G, ADD H, DELETE FOUR LETTERS, ADD I 

Explanation

After performing the given operations on the circular queue, the position of FRONT will be 7 and the position of REAR will be 9. This is because the initial positions of FRONT and REAR were 1 and 5 respectively. The operations ADD F and DELETE TWO LETTERS do not change the positions of FRONT and REAR. Then, ADD G and ADD H increment the REAR position by 1 each time. DELETE FOUR LETTERS decreases the REAR position by 4. Finally, ADD I increments the REAR position by 1. Thus, the final positions of FRONT and REAR are 7 and 9 respectively.

Submit
4. Consider a dequeue of capacity 10 elements is implemented with an array of dimension 10. The insertion and deletion operation can be carried out at either of LEFT and RIGHT end. Initially, LEFT = 1 and RIGHT = 5. 
 ABCDE    
 What will be status of LEFT and RIGHT, after performing the following operations on the queue?Add F on the left, Add G on the right, Add H on the right, Delete two letters from the left, Add I on the right, Add J on the left, Delete two letters from left. 

Explanation

not-available-via-ai

Submit
5. In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a NONEMPTY queue?

Explanation

In a linked list implementation of a queue, the front pointer always points to the first element in the queue, while the rear pointer points to the last element. During an insertion into a nonempty queue, only the rear pointer will change because a new element is added to the end of the queue. The front pointer remains unchanged as it still points to the first element in the queue.

Submit
6. The initial configuration of a queue is a, b, c, d, e ('a' is in the front end). To get the configuration e, d, c, b, a, one needs a minimum of :

Explanation

not-available-via-ai

Submit
7. Suppose a circular queue of capacity n 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 = -1. The conditions to detect queue full and queue empty are:

Explanation

The correct answer is Full: (REAR+1) mod n = = FRONT, empty: REAR = = FRONT= -1. This answer correctly represents the conditions to detect a full and empty queue in a circular queue implemented with an array. The condition for a full queue is when the next position after REAR is equal to FRONT, and the condition for an empty queue is when both REAR and FRONT are equal to -1.

Submit
8. Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:isEmpty(Q) – returns true if the queue is empty, false otherwise.delete(Q) – deletes the element at the front of the queue and returns its value.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);f(Q)insert(Q, i);}}What operation is performed by the above function f? 

Explanation

The given function f recursively deletes the element at the front of the queue Q and inserts it at the rear, effectively reversing the order of elements in the queue. This is because the function first deletes the front element and stores it in variable i, then calls itself recursively on the remaining queue, and finally inserts the stored element i at the rear of the queue. This process is repeated until the queue becomes empty, resulting in the reversal of elements in the queue.

Submit
9. Which representation of priority queue is more time and more space efficient, respectively. 

Explanation

A circular array for each priority and linked list is more time efficient because it allows for constant time access to the highest priority element in the queue. The circular array ensures that the elements with the highest priority are always at the front of the queue, making it easy to retrieve them. On the other hand, using a linked list for each priority allows for efficient insertion and removal of elements, which makes it more space efficient. This is because the linked list only requires memory for the elements that are actually in the queue, whereas the circular array needs memory for the maximum possible number of elements.

Submit
10. If the MAX_SIZE is the size of the array used in the implementation of circular queue, array index start with 0, Front point to the first element in the queue, and Rear point to the last element in the queue. Which of the following condition specify that circular queue is FULL? 

Explanation

not-available-via-ai

Submit
View My Results

Quiz Review Timeline (Updated): Mar 17, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 06, 2017
    Quiz Created by
    Ashishjn.mecs1
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
If the MAX_SIZE is the size of the array used in the implementation of...
Which of the following is a collection of items into which items can...
Suppose a circular queue of capacity 10 elements is implemented with...
Consider a dequeue of capacity 10 elements is implemented with an...
In linked list implementation of a queue, front and rear pointers are...
The initial configuration of a queue is a, b, c, d, e ('a' is...
Suppose a circular queue of capacity n elements is implemented with an...
Suppose you are given an implementation of a queue of integers. The...
Which representation of priority queue is more time and more space...
If the MAX_SIZE is the size of the array used in the implementation of...
Alert!

Advertisement