|
2 | 2 | "version": 2.0, |
3 | 3 | "questions": [ |
4 | 4 | { |
5 | | - "question": "This is a Sample Question 1?", |
| 5 | + "question": "In Lamport's mutual exclusion algorithm, what is used to order requests for the Critical Section?", |
6 | 6 | "answers": { |
7 | | - "a": "answer1", |
8 | | - "b": "answer2", |
9 | | - "c": "answer3", |
10 | | - "d": "answer4" |
| 7 | + "a": "Physical clock timestamps", |
| 8 | + "b": "Logical clock timestamps", |
| 9 | + "c": "Process IDs only", |
| 10 | + "d": "Random priorities" |
11 | 11 | }, |
12 | 12 | "explanations": { |
13 | | - "a": "Explanation 1 <a href='www.google.com'>here</a>", |
14 | | - "b": "Explanation 2", |
15 | | - "c": "Explanation 2", |
16 | | - "d": "Explanation 2" |
| 13 | + "a": "Incorrect. Physical clocks can vary between machines and are not reliable.", |
| 14 | + "b": "Correct. Lamport's algorithm uses logical clock timestamps.", |
| 15 | + "c": "Incorrect. Process IDs are only used to break ties.", |
| 16 | + "d": "Incorrect. There are no random priorities in Lamport's algorithm." |
| 17 | + }, |
| 18 | + "correctAnswer": "b", |
| 19 | + "difficulty": "intermediate" |
| 20 | + }, |
| 21 | + { |
| 22 | + "question": "What must a process wait for before entering the Critical Section in Lamport’s algorithm?", |
| 23 | + "answers": { |
| 24 | + "a": "Replies from all other processes", |
| 25 | + "b": "A token from a coordinator", |
| 26 | + "c": "Majority of acknowledgements", |
| 27 | + "d": "No waiting is required" |
| 28 | + }, |
| 29 | + "explanations": { |
| 30 | + "a": "Correct. A process must receive a REPLY from every other process.", |
| 31 | + "b": "Incorrect. Lamport's algorithm does not use tokens.", |
| 32 | + "c": "Incorrect. Majority is not enough; replies are needed from all.", |
| 33 | + "d": "Incorrect. Waiting is essential to ensure mutual exclusion." |
17 | 34 | }, |
18 | 35 | "correctAnswer": "a", |
19 | 36 | "difficulty": "beginner" |
20 | 37 | }, |
21 | 38 | { |
22 | | - "question": "This is a Sample Question 2?", |
| 39 | + "question": "If a link becomes slow between two processes, what is the effect on mutual exclusion?", |
23 | 40 | "answers": { |
24 | | - "a": "answer1", |
25 | | - "b": "answer2", |
26 | | - "c": "answer3", |
27 | | - "d": "answer4" |
| 41 | + "a": "The system may fail", |
| 42 | + "b": "Multiple processes can enter CS simultaneously", |
| 43 | + "c": "It delays message delivery but mutual exclusion is preserved", |
| 44 | + "d": "Processes will ignore slow links" |
28 | 45 | }, |
29 | 46 | "explanations": { |
30 | | - "a": "Explanation 1 <a href='www.google.com'>here</a>", |
31 | | - "b": "Explanation 2", |
32 | | - "c": "Explanation 2", |
33 | | - "d": "Explanation 2" |
| 47 | + "a": "Incorrect. Slow links do not cause system failure.", |
| 48 | + "b": "Incorrect. Mutual exclusion is still guaranteed.", |
| 49 | + "c": "Correct. Delays may occur but correctness is maintained.", |
| 50 | + "d": "Incorrect. Processes cannot ignore message delays." |
34 | 51 | }, |
35 | 52 | "correctAnswer": "c", |
| 53 | + "difficulty": "intermediate" |
| 54 | + }, |
| 55 | + { |
| 56 | + "question": "What happens to a process’s Request Queue after it sends a RELEASE message?", |
| 57 | + "answers": { |
| 58 | + "a": "It adds new entries", |
| 59 | + "b": "It clears the served request", |
| 60 | + "c": "It increases the clock value", |
| 61 | + "d": "It sends more REQUESTs" |
| 62 | + }, |
| 63 | + "explanations": { |
| 64 | + "a": "Incorrect. No new entries are added automatically.", |
| 65 | + "b": "Correct. After releasing CS, the served request is removed from the queue.", |
| 66 | + "c": "Incorrect. Clock updates happen when sending messages but that’s not the primary effect here.", |
| 67 | + "d": "Incorrect. It does not initiate more requests by itself." |
| 68 | + }, |
| 69 | + "correctAnswer": "b", |
| 70 | + "difficulty": "beginner" |
| 71 | + }, |
| 72 | + { |
| 73 | + "question": "In Test Mode 1, how many processes can request the Critical Section simultaneously?", |
| 74 | + "answers": { |
| 75 | + "a": "1", |
| 76 | + "b": "2", |
| 77 | + "c": "3", |
| 78 | + "d": "4" |
| 79 | + }, |
| 80 | + "explanations": { |
| 81 | + "a": "Correct. Only one process can request CS at a time in Test Mode 1.", |
| 82 | + "b": "Incorrect. That happens in Test Mode 2.", |
| 83 | + "c": "Incorrect. That happens in Test Mode 3.", |
| 84 | + "d": "Incorrect. That happens in Test Mode 4." |
| 85 | + }, |
| 86 | + "correctAnswer": "a", |
36 | 87 | "difficulty": "beginner" |
| 88 | + }, |
| 89 | + { |
| 90 | + "question": "What is the main role of the logical clock in Lamport's mutual exclusion algorithm?", |
| 91 | + "answers": { |
| 92 | + "a": "It measures real-world time", |
| 93 | + "b": "It provides unique IDs to processes", |
| 94 | + "c": "It orders events consistently across processes", |
| 95 | + "d": "It speeds up message transmission" |
| 96 | + }, |
| 97 | + "explanations": { |
| 98 | + "a": "Incorrect. Logical clocks are not tied to real-world time.", |
| 99 | + "b": "Incorrect. Process IDs are separate.", |
| 100 | + "c": "Correct. Logical clocks ensure a consistent ordering of events.", |
| 101 | + "d": "Incorrect. Clock value does not affect transmission speed." |
| 102 | + }, |
| 103 | + "correctAnswer": "c", |
| 104 | + "difficulty": "intermediate" |
| 105 | + }, |
| 106 | + { |
| 107 | + "question": "If a process receives a REQUEST from another process with a lower timestamp, what should it do?", |
| 108 | + "answers": { |
| 109 | + "a": "Immediately grant REPLY", |
| 110 | + "b": "Queue the request and wait", |
| 111 | + "c": "Enter Critical Section itself", |
| 112 | + "d": "Ignore the REQUEST" |
| 113 | + }, |
| 114 | + "explanations": { |
| 115 | + "a": "Correct. It should immediately send a REPLY if not competing.", |
| 116 | + "b": "Incorrect. It should not delay if the other process has a lower timestamp.", |
| 117 | + "c": "Incorrect. Entering CS itself would violate mutual exclusion.", |
| 118 | + "d": "Incorrect. Ignoring REQUEST violates protocol." |
| 119 | + }, |
| 120 | + "correctAnswer": "a", |
| 121 | + "difficulty": "intermediate" |
| 122 | + }, |
| 123 | + { |
| 124 | + "question": "Why is it important to clear the Reply Queue after a process enters the Critical Section and releases it?", |
| 125 | + "answers": { |
| 126 | + "a": "To reduce memory usage", |
| 127 | + "b": "To allow fresh REPLY collection for the next CS request", |
| 128 | + "c": "To avoid deadlock detection errors", |
| 129 | + "d": "To prevent logical clock reset" |
| 130 | + }, |
| 131 | + "explanations": { |
| 132 | + "a": "Incorrect. While memory matters, correctness is the main reason.", |
| 133 | + "b": "Correct. Each new CS request must independently collect fresh replies.", |
| 134 | + "c": "Incorrect. Deadlock detection is not directly related here.", |
| 135 | + "d": "Incorrect. Logical clocks are unaffected by Reply Queue clearing." |
| 136 | + }, |
| 137 | + "correctAnswer": "b", |
| 138 | + "difficulty": "intermediate" |
37 | 139 | } |
38 | 140 | ] |
39 | 141 | } |
0 commit comments