Ds Quiz 4 Cse D

10 Questions | Total Attempts: 80

SettingsSettingsSettings
Please wait...
Ds Quiz 4 Cse D

There is no negative marking


Questions and Answers
  • 1. 
    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:
    • A. 

      Full: (REAR+1) mod n = = FRONT, empty: (FRONT+1) mod n == REAR

    • B. 

      Full: REAR == FRONT, empty: (REAR+1) mod n = = FRONT

    • C. 

      Full: (FRONT+1) mod n = = REAR, empty: FRONT= =REAR=-1

    • D. 

      Full: (REAR+1) mod n = = FRONT, empty: REAR = = FRONT= -1

  • 2. 
    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 :
    • A. 

      3 deletion and 4 additions

    • B. 

      4 deletion and 3 additions

    • C. 

      4 deletion and 5 additions

    • D. 

      None

  • 3. 
    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?
    • A. 

      FIFO queue

    • B. 

      Deque

    • C. 

      Decreasing order priority queue

    • D. 

      Increasing order priority queue

  • 4. 
    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? 
    • A. 

      Rear=(Rear%1)+MAX_SIZE

    • B. 

      Rear=Rear%(MAX_SIZE+1)

    • C. 

      Rear=(Rear+1)%MAX_SIZE

    • D. 

      Rear=Rear+(1%MAX_SIZE)

  • 5. 
    Which representation of priority queue is more time and more space efficient, respectively. 
    • A. 

      Ordinary Array for Each Priority and Linked List

    • B. 

      Linked List and Ordinary Array for Each Priority

    • C. 

      Circular Array for Each Priority and Linked List

    • D. 

      Linked List and Circular Array for Each Priority

  • 6. 
    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? 
    • A. 

      Front=Rear= -1

    • B. 

      Front=(Rear+1)%MAX_SIZE

    • C. 

      Rear=Front+1

    • D. 

      Rear=(Front+1)%MAX_SIZE

  • 7. 
    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?
    • A. 

      Only front pointer

    • B. 

      Only rear pointer

    • C. 

      Both front and rear pointer

    • D. 

      None of the front and rear pointer

  • 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? 
    • A. 

      Leaves the queue Q unchanged

    • B. 

      Reverse the order of 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

  • 9. 
    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 
    • A. 

      FRONT = 8 and REAR = 0

    • B. 

      FRONT = 8 and REAR = 1

    • C. 

      FRONT = 7 and REAR = 0

    • D. 

      FRONT = 7 and REAR = 9

  • 10. 
    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. 
    • A. 

      LEFT = 1 and RIGHT = 5

    • B. 

      LEFT = 2 and RIGHT = 6

    • C. 

      LEFT = 0 and RIGHT = 6

    • D. 

      None

Back to Top Back to top