GATE 2011
81 questions
MCQ 811-mark 40 · 2-mark 41
Questions 51–55 of 81
Database table by name Loan_Records is given below.
What is the output of the following SQL query?
What is the output of the following SQL query?
SELECT count(*)
FROM(
(SELECT Borrower, Bank_Manager FROM Loan_Records) AS S
NATURAL JOIN
(SELECT Bank_Manager, Loan_Amount FROM Loan_Records) AS T); Answer: (C)
The natural join uses the common column Bank_Manager:
- Sunderajan: S has 2 rows and T has 2 rows, so 2 2 = 4
- Ramgopal: 1 1 = 1
Total count = 5
Answer: 5
- Sunderajan: S has 2 rows and T has 2 rows, so 2 2 = 4
- Ramgopal: 1 1 = 1
Total count = 5
Answer: 5
Consider a database table T containing two columns X and Y each of type integer. After the creation of the table, one record (X=1,Y=1) is inserted in the table.
Let MX and MY denote the respective maximum values of X and Y among all records in the table at any point in time. Using MX and MY, new records are inserted in the table 128 times with X and Y values being MX+1, 2*MY+1 respectively. It may be noted that each time after the insertion, values of MX and MY change.
What will be the output of the following SQL query after the steps mentioned above are carried out?
SELECT Y FROM T WHERE X=7;
Let MX and MY denote the respective maximum values of X and Y among all records in the table at any point in time. Using MX and MY, new records are inserted in the table 128 times with X and Y values being MX+1, 2*MY+1 respectively. It may be noted that each time after the insertion, values of MX and MY change.
What will be the output of the following SQL query after the steps mentioned above are carried out?
SELECT Y FROM T WHERE X=7;
Answer: (A)
The table rows are (1, 1), (2, 3), (3, 7), (4, 15), and so on. Every new Y is 2Y + 1, so the pattern is .
For X = 7, the value of Y:
Answer: 127
For X = 7, the value of Y:
Answer: 127
Consider a network with five nodes, N1 to N5, as shown below
The network uses a Distance Vector Routing protocol. Once the routes have stabilized, the distance vectors at different nodes are as following. N1: (0, 1, 7, 8, 4) N2: (1, 0, 6, 7, 3) N3: (7, 6, 0, 2, 6) N4: (8, 7, 2, 0, 4) N5: (4, 3, 6, 4, 0) Each distance vector is the distance of the best known path at the instance to nodes, N1 to N5, where the distance to itself is 0. Also, all links are symmetric and the cost is identical in both directions. In each round, all nodes exchange their distance vectors with their respective neighbors. Then all nodes update their distance vectors. In between two rounds, any change in cost of a link will cause the two incident nodes to change only that entry in their distance vectors.
After the update in the previous question (the cost of link N2-N3 reduces to 2 in both directions, and the next round of updates is done), the link N1-N2 goes down. N2 will reflect this change immediately in its distance vector cost as, . After the NEXT ROUND of update, what will be the cost to N1 in the distance vector of N3?
The network uses a Distance Vector Routing protocol. Once the routes have stabilized, the distance vectors at different nodes are as following. N1: (0, 1, 7, 8, 4) N2: (1, 0, 6, 7, 3) N3: (7, 6, 0, 2, 6) N4: (8, 7, 2, 0, 4) N5: (4, 3, 6, 4, 0) Each distance vector is the distance of the best known path at the instance to nodes, N1 to N5, where the distance to itself is 0. Also, all links are symmetric and the cost is identical in both directions. In each round, all nodes exchange their distance vectors with their respective neighbors. Then all nodes update their distance vectors. In between two rounds, any change in cost of a link will cause the two incident nodes to change only that entry in their distance vectors.
After the update in the previous question (the cost of link N2-N3 reduces to 2 in both directions, and the next round of updates is done), the link N1-N2 goes down. N2 will reflect this change immediately in its distance vector cost as, . After the NEXT ROUND of update, what will be the cost to N1 in the distance vector of N3?
Answer: (C)
After N1-N2 goes down, N2 sets its cost to N1 to . Only N2 and N1 change at once. N3 and N4 still hold their old vectors.
N3 has two neighbours, N2 and N4, and the link N3-N4 costs 2 (from the figure). In the next round N3 reads their vectors.
Via N2: N2 now says , so this route costs whatever the N3-N2 link costs.
Via N4: N4 still says 8 to N1. That value comes from the previous round: , that is, N4 hears 7 from N3 and 4 from N5. N4 does not yet know that its route through N5 and N2 is broken.
Answer: (C)
N3 has two neighbours, N2 and N4, and the link N3-N4 costs 2 (from the figure). In the next round N3 reads their vectors.
Via N2: N2 now says , so this route costs whatever the N3-N2 link costs.
Via N4: N4 still says 8 to N1. That value comes from the previous round: , that is, N4 hears 7 from N3 and 4 from N5. N4 does not yet know that its route through N5 and N2 is broken.
Answer: (C)
Consider a network with five nodes, N1 to N5, as shown below
The network uses a Distance Vector Routing protocol. Once the routes have stabilized, the distance vectors at different nodes are as following. N1: (0, 1, 7, 8, 4) N2: (1, 0, 6, 7, 3) N3: (7, 6, 0, 2, 6) N4: (8, 7, 2, 0, 4) N5: (4, 3, 6, 4, 0) Each distance vector is the distance of the best known path at the instance to nodes, N1 to N5, where the distance to itself is 0. Also, all links are symmetric and the cost is identical in both directions. In each round, all nodes exchange their distance vectors with their respective neighbors. Then all nodes update their distance vectors. In between two rounds, any change in cost of a link will cause the two incident nodes to change only that entry in their distance vectors.
The cost of link N2-N3 reduces to 2(in both directions). After the next round of updates, what will be the new distance vector at node, N3?
The network uses a Distance Vector Routing protocol. Once the routes have stabilized, the distance vectors at different nodes are as following. N1: (0, 1, 7, 8, 4) N2: (1, 0, 6, 7, 3) N3: (7, 6, 0, 2, 6) N4: (8, 7, 2, 0, 4) N5: (4, 3, 6, 4, 0) Each distance vector is the distance of the best known path at the instance to nodes, N1 to N5, where the distance to itself is 0. Also, all links are symmetric and the cost is identical in both directions. In each round, all nodes exchange their distance vectors with their respective neighbors. Then all nodes update their distance vectors. In between two rounds, any change in cost of a link will cause the two incident nodes to change only that entry in their distance vectors.
The cost of link N2-N3 reduces to 2(in both directions). After the next round of updates, what will be the new distance vector at node, N3?
Answer: (A)
N3 has two neighbours: N2, whose link cost is now 2, and N4, whose link cost is 2. These are the vectors N3 receives:
N2 = (1, 0, 2, 7, 3), N4 = (8, 7, 2, 0, 4)
- To N1: min(2 + 1, 2 + 8) = 3
- To N2: 2, and to N4: 2
- To N5: min(2 + 3, 2 + 4) = 5
The new vector at N3 is (3, 2, 0, 2, 5)
Answer: (3, 2, 0, 2, 5)
N2 = (1, 0, 2, 7, 3), N4 = (8, 7, 2, 0, 4)
- To N1: min(2 + 1, 2 + 8) = 3
- To N2: 2, and to N4: 2
- To N5: min(2 + 3, 2 + 4) = 5
The new vector at N3 is (3, 2, 0, 2, 5)
Answer: (3, 2, 0, 2, 5)
A layer-4 firewall (a device that can look at all protocol headers up to the transport layer) CANNOT
Answer: (D)
A layer-4 firewall can read the IP header (source and destination addresses, protocol field) and the TCP/UDP header (port numbers).
(A) HTTP uses a well-known port (80), so the firewall can match it. The 9:00 PM to 5:00 AM window is checked against the firewall's own clock, not against header data, so a time rule is possible.
(B) ICMP is identified by the protocol field of the IP header, so all ICMP traffic can be blocked.
(C) Source and destination addresses tell incoming packets from outgoing ones. A rule can drop packets whose source is that IP address and allow packets whose destination is that IP address.
(D) No header carries the name of the user who sent a packet from a multi-user machine; all users share the same IP address. So the firewall cannot separate one user's TCP traffic, even with the time rule.
Answer: (D)
(A) HTTP uses a well-known port (80), so the firewall can match it. The 9:00 PM to 5:00 AM window is checked against the firewall's own clock, not against header data, so a time rule is possible.
(B) ICMP is identified by the protocol field of the IP header, so all ICMP traffic can be blocked.
(C) Source and destination addresses tell incoming packets from outgoing ones. A rule can drop packets whose source is that IP address and allow packets whose destination is that IP address.
(D) No header carries the name of the user who sent a packet from a multi-user machine; all users share the same IP address. So the firewall cannot separate one user's TCP traffic, even with the time rule.
Answer: (D)