GATE 2024
64 questions
MCQ 36 · MSQ 12 · NAT 161-mark 29 · 2-mark 35
Questions 26–30 of 64
Let the minimum, maximum, mean and standard deviation values for the attribute income of data scientists be Rs. 46000, Rs. 170000, Rs. 96000, and Rs. 21000, respectively. The -score normalized income value of Rs. 106000 is closest to which ONE of the following options?
Answer: (B)
Use this formula for the z-score normalized value:
Here:
- is the value given (₹106000 here),
- is the mean (₹96000),
- is the standard deviation (₹21000).
Put in the values:
So the z-score normalized income of ₹106000 is closest to:
B. 0.476
Here:
- is the value given (₹106000 here),
- is the mean (₹96000),
- is the standard deviation (₹21000).
Put in the values:
So the z-score normalized income of ₹106000 is closest to:
B. 0.476
Consider the following tree traversals on a full binary tree:
(i) Preorder
(ii) Inorder
(iii) Postorder
Which of the following traversal options is/are sufficient to uniquely reconstruct the full binary tree?
(i) Preorder
(ii) Inorder
(iii) Postorder
Which of the following traversal options is/are sufficient to uniquely reconstruct the full binary tree?
One or more options are correct.
Answer: (A), (B), (C)
In a full binary tree every node has 0 or 2 children. Assume the node labels are all different.
(A) Pre-order and in-order: the first pre-order element is the root. Its position in the in-order splits the nodes into the left and right subtrees. Repeat on each part. This rebuilds any binary tree uniquely.
(B) In-order and post-order: the last post-order element is the root. Splitting the in-order at the root works in the same way. This also rebuilds any binary tree uniquely.
(C) Pre-order and post-order: in general these do not decide whether a lone child is left or right. In a full tree there is no lone child. The element after the root in pre-order is the root of the left subtree. Its position in post-order gives the size of the left subtree, so both subtrees can be cut out and the steps repeated. So the tree is unique.
(D) In-order alone is not enough. For nodes 1 to 5, root 2 with left child 1 and right child 4 (children 3 and 5) is a full tree with in-order 1 2 3 4 5. So is root 4 with left child 2 (children 1 and 3) and right child 5. The two trees are different but have the same in-order.
Answer: (A), (B), (C)
(A) Pre-order and in-order: the first pre-order element is the root. Its position in the in-order splits the nodes into the left and right subtrees. Repeat on each part. This rebuilds any binary tree uniquely.
(B) In-order and post-order: the last post-order element is the root. Splitting the in-order at the root works in the same way. This also rebuilds any binary tree uniquely.
(C) Pre-order and post-order: in general these do not decide whether a lone child is left or right. In a full tree there is no lone child. The element after the root in pre-order is the root of the left subtree. Its position in post-order gives the size of the left subtree, so both subtrees can be cut out and the steps repeated. So the tree is unique.
(D) In-order alone is not enough. For nodes 1 to 5, root 2 with left child 1 and right child 4 (children 3 and 5) is a full tree with in-order 1 2 3 4 5. So is root 4 with left child 2 (children 1 and 3) and right child 5. The two trees are different but have the same in-order.
Answer: (A), (B), (C)
Let and be two propositions. Which of the following statements is a tautology /are tautologies?
One or more options are correct.
Answer: (B), (C), (D)
An implication is false only when the left side is true and the right side is false. So for each statement, make the right side false and check the left side with the same values.
- (A) The right side is false only for . Then the left side . So we get . Not a tautology.
- (B) The right side is false only for . Then the left side . So we get . Tautology.
- (C) The right side is false only for . Then the left side . Tautology.
- (D) The right side is false only for . Then the left side . Tautology.
For B, C and D the left side is false in the only case where the right side is false, so the implication is true in every case.
Answer: (B), (C), (D)
- (A) The right side is false only for . Then the left side . So we get . Not a tautology.
- (B) The right side is false only for . Then the left side . So we get . Tautology.
- (C) The right side is false only for . Then the left side . Tautology.
- (D) The right side is false only for . Then the left side . Tautology.
For B, C and D the left side is false in the only case where the right side is false, so the implication is true in every case.
Answer: (B), (C), (D)
Consider sorting the following array of integers in ascending order using an in-place Quicksort algorithm that uses the last element as the pivot.
The minimum number of swaps performed during this Quicksort is ____
The minimum number of swaps performed during this Quicksort is ____
Answer: 0
With the last element as pivot, each partition moves the elements smaller than the pivot to its left and the larger ones to its right. A swap is needed only when an element is on the wrong side of the pivot.
Pivot is the largest element, so are already on its left and is already in its final place. The right part is empty. No swap is needed.
Next, has pivot , again the largest, so again no swap. Then has pivot and has pivot , each with no swap. has one element and needs nothing.
So every partition finds nothing out of place, and the number of swaps is . A swap of an element with itself changes nothing, so it is not counted. The count cannot go below .
Answer: 0
Pivot is the largest element, so are already on its left and is already in its final place. The right part is empty. No swap is needed.
Next, has pivot , again the largest, so again no swap. Then has pivot and has pivot , each with no swap. has one element and needs nothing.
So every partition finds nothing out of place, and the number of swaps is . A swap of an element with itself changes nothing, so it is not counted. The count cannot go below .
Answer: 0
Consider the following two tables named Raider and Team in a relational database maintained by a Kabaddi league. The attribute ID in table Team references the primary key of the Raider table, ID.
The SQL query described below is executed on this database:
The SQL query described below is executed on this database:
SELECT *
FROM Raider, Team
WHERE Raider.ID=Team.ID AND City=“Jaipur” AND
RaidPoints > 200; The number of rows returned by this query is _________ .Answer: 3
| ID | Name | Raid | Raid Point | City | Bid Point |
| 1 | ARJUN | 200 | 250 | JAIPUR | 250 |
| 2 | ANKUSH | 190 | 219 | JAIPUR | 200 |
| 3 | SUNIL | 150 | 200 | PATNA | 195 |
| 4 | REZA | 150 | 190 | PATNA | 200 |
| 5 | PRATHAM | 175 | 220 | HYDERABAD | 175 |
| 6 | GOPAL | 193 | 215 | JAIPUR | 200 |
This table is the result of the join condition
In this table, keep only the rows where Raid Point is This gives four tuples.
| ID | Name | Raid | Raid Point | City | Bid Point |
| 1 | ARJUN | 200 | 250 | JAIPUR | 250 |
| 2 | ANKUSH | 190 | 219 | JAIPUR | 200 |
| 5 | PRATHAM | 175 | 220 | HYDERABAD | 175 |
| 6 | GOPAL | 193 | 215 | JAIPUR | 200 |
Now, from this table, keep only the tuples whose city is "JAIPUR". We get:
| ID | Name | Raid | Raid Point | City | Bid Point |
| 1 | ARJUN | 200 | 250 | JAIPUR | 250 |
| 2 | ANKUSH | 190 | 219 | JAIPUR | 200 |
| 6 | GOPAL | 193 | 215 | JAIPUR | 200 |
So the SQL query returns three tuples as output.