Question
Consider the following Java code snippet: Â Â
import java.util.PriorityQueue;   import java.util.Comparator;   class Item {     int priority;     String name;     public Item(int priority, String name) {       this.priority = priority;       this.name = name;     }     @Override     public String toString() {       return name + "(" + priority + ")";     }   }   public class HeapQuestion7 {     public static void main(String[] args) {       // Create a min-heap based on 'priority'       PriorityQueue pq = new PriorityQueue(Comparator.comparingInt(item -> item.priority));       pq.add(new Item(5, "Task A"));       pq.add(new Item(1, "Task B"));       pq.add(new Item(10, "Task C"));       pq.add(new Item(3, "Task D"));       System.out.println(pq.poll().name);       System.out.println(pq.poll().name);     }   }   What will be the output of this program?Solution
The PriorityQueue is initialized with a Comparator that orders Item objects based on their priority field in ascending order (min-heap behavior for priority).   1. pq.add(new Item(5, "Task A"));   2. pq.add(new Item(1, "Task B"));   3. pq.add(new Item(10, "Task C"));   4. pq.add(new Item(3, "Task D"));     After these additions, the item with the lowest priority value will be at the head of the queue. The priorities are 1, 3, 5, 10.   5. System.out.println(pq.poll().name);     The item with priority 1 ("Task B") is removed and its name is printed.   6. System.out.println(pq.poll().name);     The next item with the lowest priority (from the remaining items) is the one with priority 3 ("Task D"). It is removed and its name is printed.   Therefore, the output is Task B, Task D.
Select the correct active form of the given sentence.
The strike has been called off by the workers.
Meera was cooking Italian.
Let the silence be maintained.
Sentence has been given in Active Voice. Out of the four alternatives suggested select the one which best expresses the same sentence in Passive Voice....
Choose the correct active/passive voice, which best expresses the following sentence:- Help the needy.
 India and Bhutan signed ten MOUs in the field of space research, aviation, power and education.
Select the correct active form of the given sentence.
He had been selected for the job by a topmost company.
Convert the given Active voice into the Passive voice.Â
Are they planning a surprise party?Â
Select the correct passive form of the given sentence.
The Indian army has inducted several women officers in Infantry and Armoured Corps.
...Select the option that expresses the following sentence in passive voice:
The teacher is checking the answer sheets.