GATE 2020
64 questions
MCQ 41 · NAT 231-mark 29 · 2-mark 35
Questions 21–25 of 64
Consider the following statements about process state transitions for a system using preemptive scheduling.
I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.
Which of the above statements are TRUE?
I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.
Which of the above statements are TRUE?
Answer: (C)
Let us go through each statement:
- Running Ready (preemption) can happen.
- Ready Running (dispatch) can happen.
- Blocked Running cannot happen; a blocked process goes to Ready first.
- Blocked Ready (I/O done) can happen.
Answer: I, II and IV only
- Running Ready (preemption) can happen.
- Ready Running (dispatch) can happen.
- Blocked Running cannot happen; a blocked process goes to Ready first.
- Blocked Ready (I/O done) can happen.
Answer: I, II and IV only
Consider a relational database containing the following schemas.
The primary key of each table is indicated by underlining the constituent fields.
The number of rows returned by the above SQL query is
The primary key of each table is indicated by underlining the constituent fields.
SELECT s.sno, s.sname
FROM Suppliers s, Catalogue c
WHERE s.sno=c.sno AND
cost > (SELECT AVG (cost)
FROM Catalogue
WHERE pno = 'P4'
GROUP BY pno) ;The number of rows returned by the above SQL query is
Answer: (A)
Subquery: only the P4 rows are used, at cost 200 (S2) and 250 (S3). Their average is . GROUP BY pno gives a single group, so the subquery returns one value.
The Catalogue rows with cost 225 are (S2, P5, 250), (S3, P1, 250), (S3, P5, 300) and (S3, P4, 250). That is 4 rows.
The join s.sno = c.sno matches each of these rows to exactly one supplier, because sno is the key of Suppliers. The query has no DISTINCT, so the supplier S3 is listed three times and S2 once. The query returns 4 rows.
Answer: (A)
The Catalogue rows with cost 225 are (S2, P5, 250), (S3, P1, 250), (S3, P5, 300) and (S3, P4, 250). That is 4 rows.
The join s.sno = c.sno matches each of these rows to exactly one supplier, because sno is the key of Suppliers. The query has no DISTINCT, so the supplier S3 is listed three times and S2 once. The query returns 4 rows.
Answer: (A)
Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?
Answer: (A)
In an ER diagram, the relationship between a weak entity and its owner is called the identifying relationship. It is shown as a diamond with a double border. The weak entity itself is shown as a double rectangle.
Answer: Diamonds with double/bold border
Answer: Diamonds with double/bold border
Consider the following statements about the functionality of an IP based router.
I. A router does not modify the IP packets during forwarding.
II. It is not necessary for a router to implement any routing protocol.
III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet.
Which of the above statements is/are TRUE?
I. A router does not modify the IP packets during forwarding.
II. It is not necessary for a router to implement any routing protocol.
III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet.
Which of the above statements is/are TRUE?
Answer: (D)
Let us look at each statement:
- I: a router makes changes to the packet (it lowers the TTL, updates the checksum, and may fragment it) so this is FALSE.
- II: a router can run with static routes alone and needs no routing protocol so this is TRUE.
- III: a router never reassembles fragments; only the destination does this so this is FALSE.
Answer: II only
- I: a router makes changes to the packet (it lowers the TTL, updates the checksum, and may fragment it) so this is FALSE.
- II: a router can run with static routes alone and needs no routing protocol so this is TRUE.
- III: a router never reassembles fragments; only the destination does this so this is FALSE.
Answer: II only
What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order?
Answer: (C)
The list must stay sorted, so every insertion first walks the list to find the right place. When the list already has k elements, this takes up to k steps.
Worst case total:
Answer:
Worst case total:
Answer: