Question
Consider the following Java-like pseudo-code for inserting a node into a Binary Search Tree (BS
- T : ```java class Node { int data; Node left, right; public Node(int item) { data = item; left = right = null; } } class BST { Node root; BST() { root = null; } void insert(int data) { root = insertRec(root, data); } Node insertRec(Node root, int data) { if (root == null) { root = new Node(data); return root; } if (data < root.data) { root.left = insertRec(root.left, data); } else if (data > root.data) { root.right = insertRec(root.right, data); } // If data == root.data, do nothing (assume no duplicates) return root; } } ``` If you insert the following sequence of numbers into an initially empty BST: `50, 30, 70, 20, 40, 60, 80`, what will be the data of the node that has `40` as its right child?
More IT DBMS Questions
- A relation R(A, B, C, D) has the composite candidate key {A, B}, and the functional dependencies AB→C and C→D hold, where C fully depends on the entire key...
- A table contains 1,000,000 records, and a B+ tree index built on it has a fan-out (branching order) of exactly 100 at each internal node. What is the appro...
- Which normal form ensures that every determinant is a candidate key?
- Transaction T1 updates a row but has not yet committed. Transaction T2 then reads this updated but uncommitted value. If T1 subsequently rolls back, what p...
- What is a page fault?
- Which deadlock prevention scheme allows older transactions to preempt younger ones?
- Phantom Reads occur when:
- In a database with a foreign key constraint defined using "ON DELETE CASCADE," what happens when a row in the parent (referenced) table is deleted?
- In a program that manages a collection of `Employee` objects, each with a `salary` attribute, which control flow mechanism would be most efficient to find ...
- Indexing in DBMS improves:
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)