GATE 2015 (Session 3)
65 questions
MCQ 45 · NAT 201-mark 30 · 2-mark 35
Questions 31–35 of 65
Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes
Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?
Process X Process Y
/* other code for process X */ /* other code for process Y */
while(true) while(true)
{ {
varP = true; varQ = true;
while(varQ == true) while(varP == true)
{ {
/* Critical Section */ /* Critical Section */
varP = false; varQ = false;
} }
} }
/* other code for process X */ /* other code for process Y */ Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?
Answer: (A)
Say X sets varP = true and Y sets varQ = true. Then both while conditions are true, so both processes go into the critical section together mutual exclusion is not guaranteed.
No process ever waits for the other one to move on (the critical section sits inside the loop, not after a busy-wait). So there is no deadlock.
Answer: prevents deadlock but fails to guarantee mutual exclusion
No process ever waits for the other one to move on (the critical section sits inside the loop, not after a busy-wait). So there is no deadlock.
Answer: prevents deadlock but fails to guarantee mutual exclusion
Let L be the language represented by the regular expression where ={0,1}. What is the minimum number of states in a DFA that recognizes (complement of L)?
Answer: (B)
A DFA for "contains 0011" tracks how much of the pattern is matched: s0 (nothing), s1 ("0"), s2 ("00"), s3 ("001") and s4 (0011 found, a trap state that loops on 0 and 1). Transitions: s0 on 0 goes to s1, on 1 stays. s1 on 0 goes to s2, on 1 goes to s0. s2 on 0 stays in s2, on 1 goes to s3. s3 on 0 goes to s1 (the string ends in 0), on 1 goes to s4.
The complement uses the same DFA with final and non-final states swapped: s0 to s3 are final and s4 is not. It has 5 states.
All 5 states are pairwise distinguishable, so none can be merged: the empty string separates s4 from the rest, "1" separates s3 from s0, s1 and s2, "11" separates s2 from s0 and s1, and "011" separates s1 from s0.
Answer: (B)
The complement uses the same DFA with final and non-final states swapped: s0 to s3 are final and s4 is not. It has 5 states.
All 5 states are pairwise distinguishable, so none can be merged: the empty string separates s4 from the rest, "1" separates s3 from s0, s1 and s2, "11" separates s2 from s0 and s1, and "011" separates s1 from s0.
Answer: (B)
Consider a software program that is artificially seeded with 100 faults. While testing this program, 159 faults are detected, out of which 75 faults are from those artificially seeded faults. Assuming that both real and seeded faults are of same nature and have same distribution, the estimated number of undetected real faults is ________.
Answer: 28
Testing found 75 of the 100 seeded faults, a detection rate of . Real faults are of the same nature, so take the same rate for them.
Real faults found
Estimated total real faults
Undetected real faults
Answer: 28
Real faults found
Estimated total real faults
Undetected real faults
Answer: 28
Consider a machine with a byte addressable main memory of bytes, block size of 16 bytes and a direct mapped cache having cache lines. Let the addresses of two consecutive bytes in main memory be and . What are the tag and cache line address (in hex) for main memory address ?
Answer: (A)
The address has 20 bits. Offset = 4 bits (block is 16 bytes). Line = 12 bits ( lines). Tag = 20 16 = 4 bits.
E201F = E | 201 | F tag = E, line = 201
Answer: E, 201
E201F = E | 201 | F tag = E, line = 201
Answer: E, 201
Consider a CSMA/CD network that transmits data at a rate of 100 Mbps ( bits per second) over a 1 km (kilometer) cable with no repeaters. If the minimum frame size required for this network is 1250 bytes, what is the signal speed (km/sec) in the cable?
Answer: (D)
For CSMA/CD, the condition is :
Find the propagation time:
Signal speed = 1 km / 50 = 20000 km/s
Answer: 20000
Find the propagation time:
Signal speed = 1 km / 50 = 20000 km/s
Answer: 20000