|
2 | 2 | "version": 2.0,
|
3 | 3 | "questions": [
|
4 | 4 | {
|
5 |
| - "question": "This is a Sample Question 1?", |
| 5 | + "question": "What is the main purpose of Lamport's algorithm in distributed systems?", |
6 | 6 | "answers": {
|
7 |
| - "a": "answer1", |
8 |
| - "b": "answer2", |
9 |
| - "c": "answer3", |
10 |
| - "d": "answer4" |
| 7 | + "a": "To provide fault tolerance during process crashes", |
| 8 | + "b": "To ensure only one process can access the critical section at a time", |
| 9 | + "c": "To synchronize clocks across all processes in the system", |
| 10 | + "d": "To maximize throughput in distributed systems" |
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. Lamport's algorithm focuses on mutual exclusion, not fault tolerance.", |
| 14 | + "b": "Correct. The algorithm ensures that only one process can access the critical section at any given time.", |
| 15 | + "c": "Incorrect. While Lamport's algorithm uses logical timestamps, it does not synchronize clocks.", |
| 16 | + "d": "Incorrect. Lamport's algorithm prioritizes mutual exclusion, not throughput maximization." |
17 | 17 | },
|
18 |
| - "correctAnswer": "a", |
| 18 | + "correctAnswer": "b", |
| 19 | + "difficulty": "beginner" |
| 20 | + }, |
| 21 | + { |
| 22 | + "question": "How does Lamport's algorithm resolve conflicts when two processes request the critical section simultaneously?", |
| 23 | + "answers": { |
| 24 | + "a": "By using a round-robin approach to give each process equal time", |
| 25 | + "b": "By comparing the timestamps of the requests and allowing the process with the smaller timestamp to enter", |
| 26 | + "c": "By randomly choosing which process gets to enter", |
| 27 | + "d": "By blocking all requests until the first process finishes executing" |
| 28 | + }, |
| 29 | + "explanations": { |
| 30 | + "a": "Incorrect. Lamport’s algorithm does not use a round-robin approach.", |
| 31 | + "b": "Correct. The algorithm uses the smallest timestamp to decide which process has priority to enter the critical section.", |
| 32 | + "c": "Incorrect. The algorithm does not use randomness to resolve conflicts.", |
| 33 | + "d": "Incorrect. The algorithm does not block all requests; instead, it resolves the conflict based on timestamp comparison." |
| 34 | + }, |
| 35 | + "correctAnswer": "b", |
| 36 | + "difficulty": "intermediate" |
| 37 | + }, |
| 38 | + { |
| 39 | + "question": "What type of clock does Lamport's algorithm use to order events in a distributed system?", |
| 40 | + "answers": { |
| 41 | + "a": "Real-time clock", |
| 42 | + "b": "Physical clock", |
| 43 | + "c": "Logical clock", |
| 44 | + "d": "Global clock" |
| 45 | + }, |
| 46 | + "explanations": { |
| 47 | + "a": "Incorrect. Lamport’s algorithm uses logical clocks, not real-time clocks.", |
| 48 | + "b": "Incorrect. The algorithm does not use physical clocks, as they may be unsynchronized in distributed systems.", |
| 49 | + "c": "Correct. Lamport’s algorithm uses logical clocks to maintain a partial ordering of events.", |
| 50 | + "d": "Incorrect. Lamport’s algorithm does not require a global clock." |
| 51 | + }, |
| 52 | + "correctAnswer": "c", |
19 | 53 | "difficulty": "beginner"
|
20 | 54 | },
|
21 | 55 | {
|
22 |
| - "question": "This is a Sample Question 2?", |
| 56 | + "question": "Which of the following is **not** a feature of Lamport's algorithm for mutual exclusion?", |
23 | 57 | "answers": {
|
24 |
| - "a": "answer1", |
25 |
| - "b": "answer2", |
26 |
| - "c": "answer3", |
27 |
| - "d": "answer4" |
| 58 | + "a": "It ensures that only one process accesses the critical section at any time", |
| 59 | + "b": "It requires all processes to send messages to each other to request entry into the critical section", |
| 60 | + "c": "It resolves conflicts based on process priorities set by physical clocks", |
| 61 | + "d": "It guarantees that all processes eventually enter the critical section" |
28 | 62 | },
|
29 | 63 | "explanations": {
|
30 |
| - "a": "Explanation 1 <a href='www.google.com'>here</a>", |
31 |
| - "b": "Explanation 2", |
32 |
| - "c": "Explanation 2", |
33 |
| - "d": "Explanation 2" |
| 64 | + "a": "Incorrect. This is the main goal of Lamport’s algorithm.", |
| 65 | + "b": "Incorrect. Lamport’s algorithm relies on message passing to request entry to the critical section.", |
| 66 | + "c": "Correct. Lamport's algorithm does not rely on physical clocks; it uses logical timestamps.", |
| 67 | + "d": "Incorrect. Lamport’s algorithm ensures fairness by resolving conflicts based on timestamps." |
34 | 68 | },
|
35 | 69 | "correctAnswer": "c",
|
| 70 | + "difficulty": "intermediate" |
| 71 | + }, |
| 72 | + { |
| 73 | + "question": "In Lamport's algorithm, what must a process do before entering the critical section?", |
| 74 | + "answers": { |
| 75 | + "a": "Wait for a timeout", |
| 76 | + "b": "Send a request to all other processes and wait for a reply", |
| 77 | + "c": "Increment its clock and enter immediately", |
| 78 | + "d": "Wait for a process to release the critical section" |
| 79 | + }, |
| 80 | + "explanations": { |
| 81 | + "a": "Incorrect. Lamport's algorithm does not rely on timeouts to enter the critical section.", |
| 82 | + "b": "Correct. A process must send a request to all other processes and wait for replies before entering the critical section.", |
| 83 | + "c": "Incorrect. A process must first send requests and receive replies before entering.", |
| 84 | + "d": "Incorrect. The process must request entry and wait for replies, not wait for someone to release the critical section." |
| 85 | + }, |
| 86 | + "correctAnswer": "b", |
| 87 | + "difficulty": "beginner" |
| 88 | + }, |
| 89 | + { |
| 90 | + "question": "What happens when a process releases the critical section in Lamport's algorithm?", |
| 91 | + "answers": { |
| 92 | + "a": "It sends a message to all other processes indicating that the critical section is now available", |
| 93 | + "b": "It sends a message only to the process that requested last", |
| 94 | + "c": "It automatically enters the critical section again", |
| 95 | + "d": "It waits for the next process to request the critical section" |
| 96 | + }, |
| 97 | + "explanations": { |
| 98 | + "a": "Correct. Once a process completes its work in the critical section, it sends a release message to all other processes.", |
| 99 | + "b": "Incorrect. The process must notify all other processes, not just the one that requested last.", |
| 100 | + "c": "Incorrect. The process does not automatically re-enter the critical section after releasing it.", |
| 101 | + "d": "Incorrect. The process notifies all others that it has released the critical section, allowing them to request access." |
| 102 | + }, |
| 103 | + "correctAnswer": "a", |
36 | 104 | "difficulty": "beginner"
|
37 | 105 | }
|
38 | 106 | ]
|
|
0 commit comments