GATE 2022
65 questions
MCQ 32 · MSQ 15 · NAT 181-mark 30 · 2-mark 35
Questions 56–60 of 65
Consider the relational database with the following four schemas and their respective instances.
The number of rows returned by the above SQL query is ___
Student(sNo, sName, dNo) Dept(dNo, dName)
Course(cNo, cName, dNo) Register(sNo, cNo)
|
|
|
|
SQL Query:
SELECT * FROM Student AS S WHERE NOT EXIST
(SELECT cNo FROM Course WHERE dNo = “D01”
EXCEPT
SELECT cNo FROM Register WHERE sNo = S.sNo)The number of rows returned by the above SQL query is ___
Answer: 2
The paper prints
The query picks the students for whom the set (D01 courses) EXCEPT (courses the student registered for) is empty. So it returns the students who registered for all D01 courses.
D01 courses = {C11, C12}.
- S01: registered C11, C12. True
- S02: registered C11 only. False
- S03: registered C21, C22, C23. False
- S04: registered C11, C12. True
- S05: registered C11, C21. False
Answer: 2
NOT EXIST; it stands for SQL's NOT EXISTS. Its Register row "S03 C 23" is course C23.The query picks the students for whom the set (D01 courses) EXCEPT (courses the student registered for) is empty. So it returns the students who registered for all D01 courses.
D01 courses = {C11, C12}.
- S01: registered C11, C12. True
- S02: registered C11 only. False
- S03: registered C21, C22, C23. False
- S04: registered C11, C12. True
- S05: registered C11, C21. False
Answer: 2
Consider a network with three routers P, Q, R shown in the figure below. All the links have cost of unity.
The routers exchange distance vector routing information and have converged on the routing tables, after which the link Q-R fails. Assume that P and Q send out routing updates at random times, each at the same average rate. The probability of a routing loop formation (rounded off to one decimal place) between P and Q, leading to count-to-infinity problem, is ____
The routers exchange distance vector routing information and have converged on the routing tables, after which the link Q-R fails. Assume that P and Q send out routing updates at random times, each at the same average rate. The probability of a routing loop formation (rounded off to one decimal place) between P and Q, leading to count-to-infinity problem, is ____
Answer: 0.5
Before the failure, Q reaches R at cost 1. P reaches R at cost 2, going through Q. Now the link Q-R fails:
- If Q sends its update first, it says R is unreachable. P then learns that R is unreachable so no loop forms.
- If P sends first, it still tells Q "R is at cost 2". Q then sets its route to R through P (cost 3), while P sends its traffic through Q This is a routing loop, and count-to-infinity follows.
The two cases are equally likely, so the probability .
Answer: 0.5
- If Q sends its update first, it says R is unreachable. P then learns that R is unreachable so no loop forms.
- If P sends first, it still tells Q "R is at cost 2". Q then sets its route to R through P (cost 3), while P sends its traffic through Q This is a routing loop, and count-to-infinity follows.
The two cases are equally likely, so the probability .
Answer: 0.5
Let be a directed graph, where is the set of vertices and is the set of directed edges, as defined by the following adjacency matrix .
indicates a directed edge from node to node . A directed spanning tree of , rooted at , is defined as a subgraph of such that the undirected version of is a tree, and contains a directed path from to every other vertex in . The number of such directed spanning trees rooted at vertex 5 is ____
indicates a directed edge from node to node . A directed spanning tree of , rooted at , is defined as a subgraph of such that the undirected version of is a tree, and contains a directed path from to every other vertex in . The number of such directed spanning trees rooted at vertex 5 is ____
Answer: 24
An edge is present only when . So every edge goes from a larger vertex to a smaller one. Self-loops are of no use in a tree.
In a tree rooted at 5, every other vertex k needs exactly one parent. That parent must be a vertex larger than k:
- vertex 4: the parent is 5 1 choice
- vertex 3: the parent is 4 or 5 2 choices
- vertex 2: 3 choices
- vertex 1: 4 choices
The parent is always larger, so no cycle can form. Total number of trees
Answer: 24
In a tree rooted at 5, every other vertex k needs exactly one parent. That parent must be a vertex larger than k:
- vertex 4: the parent is 5 1 choice
- vertex 3: the parent is 4 or 5 2 choices
- vertex 2: 3 choices
- vertex 1: 4 choices
The parent is always larger, so no cycle can form. Total number of trees
Answer: 24
Consider a 100 Mbps link between an earth station (sender) and a satellite (receiver) at an altitude of 2100 km. The signal propagates at a speed of m/s. The time taken (in milliseconds, rounded off to two decimal places) for the receiver to completely receive a packet of 1000 bytes transmitted by the sender is
Answer: 7.07 to 7.09
Total time is the sum of the transmission time and the propagation time.
- Transmission time: ms
- Propagation time: ms
Adding both: ms
Answer: 7.08
- Transmission time: ms
- Propagation time: ms
Adding both: ms
Answer: 7.08
Consider the data transfer using TCP over a 1 Gbps link. Assuming that the maximum segment lifetime (MSL) is set to 60 seconds, the minimum number of bits required for the sequence number field of the TCP header, to prevent the sequence number space from wrapping around during the MSL is
Answer: 33
TCP counts bytes, not packets. Number of bytes sent in one MSL:
bytes
The sequence number space must satisfy . With 32 bits we get , which is too small. With 33 bits we get , which is enough.
Answer: 33
bytes
The sequence number space must satisfy . With 32 bits we get , which is too small. With 33 bits we get , which is enough.
Answer: 33