GATE 2015 (Session 1)
65 questions
MCQ 45 · NAT 201-mark 30 · 2-mark 35
Questions 51–55 of 65
Let G = (V, E) be a simple undirected graph, and s be a particular vertex in it called the source. For , let d(x) denote the shortest distance in G from s to x. A breadth first search (BFS) is performed starting at s. Let T be the resultant BFS tree. If (u,v) is an edge of G that is not in T, then which one of the following CANNOT be the value of d(u)-d(v)?
Answer: (D)
In a BFS of an undirected graph, the levels of the two ends of any edge differ by at most 1. Suppose d(u) d(v) were 2. Then v would have found u earlier, which gives d(u) = d(v) + 1.
So d(u) d(v) can only take the values 1, 0 or 1.
Answer: 2
So d(u) d(v) can only take the values 1, 0 or 1.
Answer: 2
Consider a uniprocessor system executing three tasks T1, T2 and T3, each of which is composed of an infinite sequence of jobs (or instances) which arrive periodically at intervals of 3, 7 and 20 milliseconds, respectively. The priority of each task is the inverse of its period, and the available tasks are scheduled in order of priority, with the highest priority task scheduled first. Each instance of T1, T2 and T3 requires an execution time of 1, 2 and 4 milliseconds, respectively. Given that all tasks initially arrive at the beginning of the 1st millisecond and task preemptions are allowed, the first instance of T3 completes its execution at the end of _____________ milliseconds.
Answer: 12
Order of priority: T1 (period 3) T2 (period 7) T3 (period 20).
Schedule:
0-1: T1 runs. 1-3: T2 runs. 3-4: T1 runs (new instance).
4-6: T3 runs (2 of its 4 ms).
6-7: T1 runs. 7-9: T2 runs. 9-10: T1 runs.
10-12: T3 runs (the remaining 2 ms) it finishes.
Answer: 12
Schedule:
0-1: T1 runs. 1-3: T2 runs. 3-4: T1 runs (new instance).
4-6: T3 runs (2 of its 4 ms).
6-7: T1 runs. 7-9: T2 runs. 9-10: T1 runs.
10-12: T3 runs (the remaining 2 ms) it finishes.
Answer: 12
A positive edge-triggered D flip-flop is connected to a positive edge-triggered JK flip-flop as follows. The Q output of the D flip-flop is connected to both the J and K inputs of the JK flip-flop, while the Q output of the JK flip-flop is connected to the input of the D flip-flop. Initially, the output of the D flip-flop is set to logic one and the output of the JK flip-flop is cleared. Which one of the following is the bit sequence (including the initial state) generated at the Q output of the JK flip-flop when the flip-flops are connected to a free-running common clock? Assume that J=K=1 is the toggle mode and J=K=0 is the state-holding mode of the JK flip-flop. Both the flip-flops have non-zero propagation delays.
Answer: (A)
On every clock, J = K = the old D output, and D copies the old JK output. Start: D = 1, Q(JK) = 0.
- Clock 1: J=K=1, toggle Q = 1; D = 0
- Clock 2: J=K=0, hold Q = 1; D = 1
- Clock 3: J=K=1, toggle Q = 0; D = 1
- Clock 4: toggle Q = 1; D = 0, then it repeats
Sequence: 0 1 1 0 1 1 0...
Answer: 0110110...
- Clock 1: J=K=1, toggle Q = 1; D = 0
- Clock 2: J=K=0, hold Q = 1; D = 1
- Clock 3: J=K=1, toggle Q = 0; D = 1
- Clock 4: toggle Q = 1; D = 0, then it repeats
Sequence: 0 1 1 0 1 1 0...
Answer: 0110110...
Consider a disk pack with a seek time of 4 milliseconds and rotational speed of 10000 rotations per minute (RPM). It has 600 sectors per track and each sector can store 512 bytes of data. Consider a file stored in the disk. The file contains 2000 sectors. Assume that every sector access necessitates a seek, and the average rotational latency for accessing each sector is half of the time for one complete rotation. The total time (in milliseconds) needed to read the entire file is ____________.
Answer: 14020
Time for one rotation = 60 / 10000 s = 6 ms.
Time for each sector: seek 4 + latency 3 + transfer 6/600 = 0.01 7.01 ms
Total time = 2000 7.01 = 14020 ms
Answer: 14020
Time for each sector: seek 4 + latency 3 + transfer 6/600 = 0.01 7.01 ms
Total time = 2000 7.01 = 14020 ms
Answer: 14020
Consider a non-pipelined processor with a clock rate of 2.5 gigahertz and average cycles per instruction of four. The same processor is upgraded to a pipelined processor with five stages; but due to the internal pipeline delay, the clock speed is reduced to 2 gigahertz. Assume that there are no stalls in the pipeline. The speed up achieved in this pipelined processor is_________.
Answer: 3.2
Compare the time per instruction in both processors:
- Non-pipelined: 4 cycles at 2.5 GHz gives 1.6 ns for each instruction.
- Pipelined (CPI 1): 1 cycle at 2 GHz gives 0.5 ns for each instruction.
Speed-up = 1.6 / 0.5 = 3.2
Answer: 3.2
- Non-pipelined: 4 cycles at 2.5 GHz gives 1.6 ns for each instruction.
- Pipelined (CPI 1): 1 cycle at 2 GHz gives 0.5 ns for each instruction.
Speed-up = 1.6 / 0.5 = 3.2
Answer: 3.2