Question 51

Computer Awareness Heaps Easy

Given the index i of a node in a heap, we can not compute:

(A) Parent (i)
(B) Heap size
(C) Left (i)
(D) Right (i)
✓ Correct Answer: Option B Verified Solution

📘 Step-by-Step Solution & Detailed Explanation:

Solution

In a heap (implemented as an array), given the index i of a node:

  • The parent index can be calculated as \( \text{Parent}(i) = \lfloor i/2 \rfloor \) (for 1-based indexing) or \( \lfloor (i-1)/2 \rfloor \) (for 0-based indexing).
  • The left child index can be calculated as \( \text{Left}(i) = 2i \) (1-based) or \( 2i+1 \) (0-based).
  • The right child index can be calculated as \( \text{Right}(i) = 2i+1 \) (1-based) or \( 2i+2 \) (0-based).

However, the heap size is not computable from the index of a node alone; it is stored separately.

Answer: Option B → Heap size

Practice Similar Heaps Questions

Reinforce your conceptual grasp with related questions from CUET-MCA 2025:

Q1 Match List-I with List-II |c|l| List-I & List-II \\ (A)\ Seek Time & (I)\...
Solve →
Q4 In case of Binary search tree which of the following procedure's running...
Solve →
Q7 External fragmentation occurs
Solve →
Q9 In the search time is independent of the number of elements n.
Solve →
Q11 A situation where two or more processes are blocked, waiting for resources...
Solve →
Full-Length Test Series

Prepare for CUET-MCA Under Real Exam Conditions

Take timed full-length mock tests with authentic question distributions, negative marking (+12/-3 in Math), and instant All India Rank calculation.

Start Free Mock Test Series →