UGC-NET Jun 2013 · Arrays & Matrix Representation

MCQ · 2 marks · Problem PROG-DSTR-0032

Consider the following statements for priority queue: S1: It is a data structure in which the intrinsic ordering of the elements does determine the result of its basic operations. S2: The elements of a priority queue may be complex structures that are ordered on one or several fields
  1. A
    Both S1 and S2 are incorrect
  2. B
    S1 is correct and S2 is incorrect
  3. C
    S1 is incorrect and S2 is correct
  4. D
    Both S1 and S2 are correct

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solution\(S_1\): in a priority queue the order in which elements leave is determined by their priorities (the intrinsic ordering of the elements), not by the order of arrival; this ordering decides what delete-min/max and similar operations return — correct.\(S_2\): elements may be records, with the priority taken from one or several fields (e.g. ordered by deadline, then by arrival time) — correct.Both statements are correct.Answer: D

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com