GATE 2020
64 questions
MCQ 41 · NAT 231-mark 29 · 2-mark 35
Questions 46–50 of 64
Consider a schedule of transactions T1 and T2:
Here, RX stands for "Read(X)" and WX stands for "Write(X)". Which one of the following schedules is conflict equivalent to the above schedule?
Here, RX stands for "Read(X)" and WX stands for "Write(X)". Which one of the following schedules is conflict equivalent to the above schedule?
Answer: (A)
Two operations conflict when they are on the same item, in different transactions, and at least one is a write. A schedule is conflict equivalent to the given one only if every conflicting pair keeps its order. These pairs conflict in the given schedule:
- Item B: the RB and WB of come before the WB of .
- Item C: the RC of comes before the WC of .
- Item D: the RD of comes before the WD of .
Item A is used only by , so it gives no conflict.
Now look at schedule (A). It runs : RB WB RD, then : RA RC WD WB, then : WC. All three orders are kept.
Each of the other schedules reverses a pair:
- (B) runs all of first, so the WB of comes before the RB and WB of (item B reversed). The WD of also comes before the RD of .
- (C) has the WD of before the RD of (item D reversed).
- (D) has the WC of before the RC of (item C reversed).
Answer: (A)
- Item B: the RB and WB of come before the WB of .
- Item C: the RC of comes before the WC of .
- Item D: the RD of comes before the WD of .
Item A is used only by , so it gives no conflict.
Now look at schedule (A). It runs : RB WB RD, then : RA RC WD WB, then : WC. All three orders are kept.
Each of the other schedules reverses a pair:
- (B) runs all of first, so the WB of comes before the RB and WB of (item B reversed). The WD of also comes before the RD of .
- (C) has the WD of before the RD of (item D reversed).
- (D) has the WC of before the RC of (item C reversed).
Answer: (A)
An organization requires a range of IP address to assign one to each of its 1500 computers. The organization has approached an Internet Service Provider (ISP) for this task. The ISP uses CIDR and serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an address space to the organization which will minimize the number of routing entries in the ISP's router using route aggregation. Which of the following address spaces are potential candidates from which the ISP can allot any one of the organization?
I. 202.61.84.0/21
II. 202.61.104.0/21
III. 202.61.64.0/21
IV. 202.61.144.0/21
I. 202.61.84.0/21
II. 202.61.104.0/21
III. 202.61.64.0/21
IV. 202.61.144.0/21
Answer: (B)
1500 hosts need addresses, which gives a /21 block. A /21 block starts at a third octet that is a multiple of 8. It must also lie inside 202.61.0.0/17 (third octet 0-127).
- I: 84 is not a multiple of 8. False
- II: 104 = 13 8. True
- III: 64 = 8 8. True
- IV: 144 is outside the /17 range. False
Answer: II and III only
- I: 84 is not a multiple of 8. False
- II: 104 = 13 8. True
- III: 64 = 8 8. True
- IV: 144 is outside the /17 range. False
Answer: II and III only
Which one of the following predicate formulae is NOT logically valid?
Note that W is a predicate formula without any free occurrence of x.
Note that W is a predicate formula without any free occurrence of x.
Answer: (C)
is not free in , so can be moved in and out of a quantifier on .
- (A) If is true, both sides are true. If is false, both sides say . So it is valid.
- (B) If is false, both sides are false. If is true, both sides say . So it is valid.
- (C) . This is the left side. It is not the same as . Example: universe , true, false, false. The left side is false, because is false. The right side is true, because is false. So (C) is not valid.
- (D) . So it is valid.
Answer: (C)
- (A) If is true, both sides are true. If is false, both sides say . So it is valid.
- (B) If is false, both sides are false. If is true, both sides say . So it is valid.
- (C) . This is the left side. It is not the same as . Example: universe , true, false, false. The left side is false, because is false. The right side is true, because is false. So (C) is not valid.
- (D) . So it is valid.
Answer: (C)
Let be a directed, weighed graph with weight function . For some function , for each edge , define as .
Which one of the options completes the following sentence so that it is TRUE?
"The shortest paths in G under are shortest paths under too,_________".
Which one of the options completes the following sentence so that it is TRUE?
"The shortest paths in G under are shortest paths under too,_________".
Answer: (A)
Take any path . The f-terms cancel in pairs, so:
Every s-to-t path changes by the same constant . So the shortest path stays the shortest, for any f. (This is the reweighting trick used in Johnson's algorithm.)
Answer: for every
Every s-to-t path changes by the same constant . So the shortest path stays the shortest, for any f. (This is the reweighting trick used in Johnson's algorithm.)
Answer: for every
In a balanced binary search tree with n elements, what is the worst case time complexity of reporting all elements in range [a,b]? Assume that the number of reported elements is k.
Answer: (B)
Find a in time, since that is the tree height. Then walk the tree in order and report elements until b is passed. The walk touches the k reported elements and boundary nodes.
Total time:
Answer:
Total time:
Answer: