📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    In Java, which interface defines the basic operations

    for a queue, and which class is a common concrete implementation that supports these operations with efficient O(1) time complexity for offer and poll?
    A List, ArrayList Correct Answer Incorrect Answer
    B Set, HashSet Correct Answer Incorrect Answer
    C Queue, LinkedList Correct Answer Incorrect Answer
    D Deque, ArrayDeque Correct Answer Incorrect Answer
    E Collection, Vector Correct Answer Incorrect Answer

    Solution

    In Java, java.util.Queue is the interface that defines queue operations. java.util.LinkedList is a common concrete class that implements the Queue interface and provides O(1) time complexity for offer() (enqueue) and poll() (dequeue) operations when used as a queue.

    Practice Next
    More IT Operating System Questions
    ask-question