GATE 2000
54 questions
MCQ 541-mark 54
Questions 46–50 of 54
Let be mutexes (binary semaphores) and be processes. Suppose each process P[i] executes the following:
wait (m[i]); wait (m[(i+1) mod 4]);
...........
release (m[i]); release (m[(i+1) mod 4]); This could cause
Answer: (B)
With the index , the first and second mutexes of each process are:
P0: m[0], m[1]
P1: m[1], m[2]
P2: m[2], m[3]
P3: m[3], m[0]
P4: m[4], m[1]
Suppose every process runs its first
This can happen, but it does not always happen, so the code "could cause" deadlock. Thrashing is a memory-management problem, so (A) is wrong. (C) and (D) are wrong because deadlock is possible.
Answer: (B)
P0: m[0], m[1]
P1: m[1], m[2]
P2: m[2], m[3]
P3: m[3], m[0]
P4: m[4], m[1]
Suppose every process runs its first
wait before any process runs its second. Then P0 holds m[0] and waits for m[1], which P1 holds. P1 holds m[1] and waits for m[2], held by P2. P2 holds m[2] and waits for m[3], held by P3. P3 holds m[3] and waits for m[0], held by P0. This is a circular wait. None of them can run its critical section or release a mutex. P4 holds m[4] and waits for m[1], so it is stuck too.This can happen, but it does not always happen, so the code "could cause" deadlock. Thrashing is a memory-management problem, so (A) is wrong. (C) and (D) are wrong because deadlock is possible.
Answer: (B)
Which of the following is not a valid deadlock prevention scheme?
Answer: (C)
(A) Valid. A process holds nothing while it asks for a new resource. This breaks the hold and wait condition, though it can lead to starvation.
(B) Valid. Requests follow the numbering, so a cycle of waiting processes cannot form. This breaks the circular wait condition.
(C) NOT valid. This only says that a process makes no request after its first release. Before that point it can still hold some resources while it waits for others, so hold and wait still exists. It also gives no ordering of requests, so circular wait is possible. For example, holds and requests , while holds and requests . Neither has released anything yet, so the rule is not broken, and they are in deadlock. None of the four conditions is prevented.
(D) Valid. All required resources are given before the process starts, so it never waits while holding something. This breaks the hold and wait condition.
Answer: (C)
(B) Valid. Requests follow the numbering, so a cycle of waiting processes cannot form. This breaks the circular wait condition.
(C) NOT valid. This only says that a process makes no request after its first release. Before that point it can still hold some resources while it waits for others, so hold and wait still exists. It also gives no ordering of requests, so circular wait is possible. For example, holds and requests , while holds and requests . Neither has released anything yet, so the rule is not broken, and they are in deadlock. None of the four conditions is prevented.
(D) Valid. All required resources are given before the process starts, so it never waits while holding something. This breaks the hold and wait condition.
Answer: (C)
Suppose the time to service a page fault is on the average 10 milliseconds, while a memory access takes 1 microsecond. Then a 99.99% hit ratio results in average memory access time of
Answer: (D)
The question says nothing about page tables. So we assume the page table access time is already part of the memory access time.
Average memory access time is then:
microseconds
Correct Answer:
Average memory access time is then:
microseconds
Correct Answer:
Given the relations
employee (name, salary, dept-no), and
department (dept-no, dept-name,address),
Which of the following queries cannot be expressed using the basic relational algebra operations ?
employee (name, salary, dept-no), and
department (dept-no, dept-name,address),
Which of the following queries cannot be expressed using the basic relational algebra operations ?
Answer: (C)
Basic relational algebra has select, project, product, join and set operations. It has no aggregation, so it cannot add up salaries. The other queries only need joins and selections.
Answer: The sum of all employees' salaries
Answer: The sum of all employees' salaries
In SQL, relations can contain null values, and comparisons with null values are treated as unknown. Suppose all comparisons with a null value are treated as false. Which of the following pairs is not equivalent?
Answer: (C)
Treat every comparison with NULL as false. Then check each pair for , and (T = true, F = false):
For NULL, the comparison is false. But is false, so is true. So the pair in C differs for NULL.
Pair A matches because is the same as . Pair B matches because an integer with must be 5, and both sides are false for NULL.
Answer: (C)
For NULL, the comparison is false. But is false, so is true. So the pair in C differs for NULL.
Pair A matches because is the same as . Pair B matches because an integer with must be 5, and both sides are false for NULL.
Answer: (C)