deque

Last Updated :
Discuss
Comments

Question 1

What is deque ?

  • A deque with insert/delete defined for both front and rear ends of queue

  • queue implemented with a circular linked list

  • a queue implemented with singly linked list

  • none of these

Question 2

Which of the following are types of restricted deques?

  • Input Restricted Deque
    Output Restricted Deque

  • circular Restricted Deque

  • head Restricted Deque
    Output Restricted Deque

  • Input Restricted Deque

Question 3

Output of given code is

Python
from collections import deque
queue = deque(['name','age','DOB'])
print(queue)
  • ['name', 'age', 'DOB']

  • deque(['name', 'age'])

  • deque['name', 'age', 'DOB']

  • deque(['name', 'age', 'DOB'])

Question 4

Deque in Python is implemented using the module __________

  • collections

  • collect

  • dequeue

  • collection

Question 5

Dequeue can be implemented using 

  • circular linked list

  • doubly-linked list 

  • doubly-linked list

  •  a circular array

Question 6

Dequeue can be applied as

  • Stack and queue 

  • stack and linked list

  • linked list 

  • queue

Question 7

Which is the correct method signature for inserting element 'a' at position 'i' in deque?

  • insert(position, element)

  • insert(element, position)

  • inserted(position, element)

  • inserting(position, element)

Question 8

extendleft(iterable) is use for

  • This function is used to add multiple values at the left end of the deque. The argument passed is iterable. Order is reversed as a result of left appends

  • This function is used to add single value at the left end of the deque. The argument passed is iterable. Order is reversed as a result of left appends

  • This function is used to add multiple values at the left end of the deque. The argument passed is iterable. 

  • none of these

Question 9

Which of the following is true

  • deque provides an O(1) time complexity for append and pop operations

  • deque provides an O(N^2) time complexity for append and pop operations

  • deque provides an O(NLogN) time complexity for append and pop operations

  • deque provides an O(N) time complexity for append and pop operations

Question 10

append() function is used for

  • This function is used to delete the value in its argument to the right end of the deque.

  • This function is used to insert the value in its argument to the right end and delete left item of the deque.

  • This function is used to insert the value in its argument to the left of the deque.

  • This function is used to insert the value in its argument to the right end of the deque.

There are 10 questions to complete.

Take a part in the ongoing discussion