GATE 2015 (Session 3)
65 questions
MCQ 45 · NAT 201-mark 30 · 2-mark 35
Questions 26–30 of 65
In a room there are only two types of people, namely Type 1 and Type 2. Type 1 people always tell the truth and Type 2 people always lie. You give a fair coin to a person in that room, without knowing which type he is from and tell him to toss it and hide the result from you till you ask for it. Upon asking, the person replies the following
"The result of the toss is head if and only if I am telling the truth."
Which of the following options is correct?
"The result of the toss is head if and only if I am telling the truth."
Which of the following options is correct?
Answer: (A)
Let H = "result is head".
- Type 1 (always truthful): the statement is true, and he is telling the truth. So H True, which gives H.
- Type 2 (always lies): the statement is false, and he is not telling the truth. The statement "H False" is false only when H is true.
In both cases the result is head.
Answer: The result is head
- Type 1 (always truthful): the statement is true, and he is telling the truth. So H True, which gives H.
- Type 2 (always lies): the statement is false, and he is not telling the truth. The statement "H False" is false only when H is true.
In both cases the result is head.
Answer: The result is head
While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is
Answer: (B)
Insert each element in order:
- 71 is the root; 65 goes left, 84 goes right
- 69 goes right of 65; 67 goes left of 69 (level 3)
- 83 goes left of 84 (level 2)
The lowest element is 67.
Answer: 67
- 71 is the root; 65 goes left, 84 goes right
- 69 goes right of 65; 67 goes left of 69 (level 3)
- 83 goes left of 84 (level 2)
The lowest element is 67.
Answer: 67
The result evaluating the postfix expression 10 5 + 60 6 / * 8 - is
Answer: (C)
Evaluate the expression step by step:
- Add 10 and 5: 10 5 + 15
- Divide 60 by 6: 60 6 / 10
- Multiply the two results: * 150
- Subtract 8: 8 142
Answer: 142
- Add 10 and 5: 10 5 + 15
- Divide 60 by 6: 60 6 / 10
- Multiply the two results: * 150
- Subtract 8: 8 142
Answer: 142
Consider the following relation
Cinema(theater, address, capacity)
Which of the following options will be needed at the end of the SQL query
SELECT P1.address FROM Cinema P1
such that it always finds the addresses of theaters with maximum capacity?
Cinema(theater, address, capacity)
Which of the following options will be needed at the end of the SQL query
SELECT P1.address FROM Cinema P1
such that it always finds the addresses of theaters with maximum capacity?
Answer: (A)
A theater has the maximum capacity when its capacity is all the capacities in the table. This means ALL.
Using ANY gives every theater. Using ALL (max) or ANY (max) gives no rows.
Answer: WHERE P1.capacity All (select P2.capacity from Cinema P2)
Using ANY gives every theater. Using ALL (max) or ANY (max) gives no rows.
Answer: WHERE P1.capacity All (select P2.capacity from Cinema P2)
Consider the following array of elements.
(89,19,50,17,12,15,2,5,7,11,6,9,100)
The minimum number of interchanges needed to convert it into a max-heap is
(89,19,50,17,12,15,2,5,7,11,6,9,100)
The minimum number of interchanges needed to convert it into a max-heap is
Answer: (D)
Only 100, which is at the last position, breaks the heap property. It moves up the tree like this:
- swap with its parent 15
- swap with its parent 50
- swap with the root 89
All other elements already follow the max-heap rule. So the number of interchanges is 3.
Answer: 3
- swap with its parent 15
- swap with its parent 50
- swap with the root 89
All other elements already follow the max-heap rule. So the number of interchanges is 3.
Answer: 3