1.

What is the correct method used to insert and delete items from the queue?(a) push and pop(b) enqueue and dequeue(c) enqueue and peek(d) add and removeThis question was posed to me by my school principal while I was bunking the class.The query is from Data Structures-Queue in section java.util – The Collections Framework of Java

Answer»

Correct choice is (b) ENQUEUE and dequeue

The best explanation: enqueue is pushing item into queue; dequeue is removing item from queue; peek returns object WITHOUT removing it from queue.

Stack uses PUSH and pop METHODS. add and remove are USED in the list.



Discussion

No Comment Found

Related InterviewSolutions