Data Structures


  1. What is the unique feature of LinkedHashSet?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Set is a collection of unique elements.HashSet has the behavior of Set and stores key value pairs. The LinkedHashSet stores the key value pairs in the order of insertion.


  1. Which of the below is not a subinterface of Queue?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    BlockingQueue, TransferQueue and BlockingQueue are subinterfaces of Queue.



  1. What is the remaining capacity of BlockingQueue whose intrinsic capacity is not defined?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    A BlockingQueue without any intrinsic capacity constraints always reports a remaining capacity of Integer.MAX_VALUE.


  1. PriorityQueue is thread safe.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    PriorityQueue is not synchronized. BlockingPriorityQueue is the thread safe implementation.



  1. What is difference between dequeue() and peek() function of java?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    dequeue() removes the item next in line. peek() returns the item without removing it from the queue.