GATE 2006
191 questions
MCQ 1911-mark 191
Questions 156–160 of 191
In the working-set strategy, which of the following is done by the operating system to prevent thrashing?
I. It initiates another process if there are enough extra frames.
II. It selects a process to suspend if the sum of the sizes of the working-sets exceeds the total number of available frames.
I. It initiates another process if there are enough extra frames.
II. It selects a process to suspend if the sum of the sizes of the working-sets exceeds the total number of available frames.
Answer: (D)
Taken from Galvin: "If there are enough extra frames, another process can be started. If the sum of the working-set sizes grows and goes above the total number of available frames, the operating system picks a process to suspend. The pages of that process are written out (swapped), and its frames are given to other processes. The suspended process can be restarted later."
So the answer is Option (D).
A computer system supports 32-bit virtual addresses as well as 32-bit physical addresses, Since the virtual address space is of the same size as the physical address space, the operating system designers decide to get rid of the virtual entirely. Which one of the following is true?
Answer: (A)
Virtual memory gives a process three things: a larger address space, memory protection and relocation. Here the 32-bit virtual space is no bigger than the physical space, so the first one is not needed. But protection between users and relocation of programs are still needed.
Without virtual memory these two can be done only in software, or by splitting the memory into fixed parts among the users. Both ways are very inefficient. Each user then gets only a small share of memory, which also limits the number of users. So efficient multi-user support is no longer possible, which is (A).
(C) is wrong because protection and relocation still need hardware support (for example base and limit registers or an MMU).
(B) is wrong because cache efficiency depends on cache size, block size and mapping, which dropping virtual memory does not change.
(D) is wrong because CPU scheduling efficiency depends on the scheduling algorithm and the mix of processes, not on address translation.
Answer: (A)
Without virtual memory these two can be done only in software, or by splitting the memory into fixed parts among the users. Both ways are very inefficient. Each user then gets only a small share of memory, which also limits the number of users. So efficient multi-user support is no longer possible, which is (A).
(C) is wrong because protection and relocation still need hardware support (for example base and limit registers or an MMU).
(B) is wrong because cache efficiency depends on cache size, block size and mapping, which dropping virtual memory does not change.
(D) is wrong because CPU scheduling efficiency depends on the scheduling algorithm and the mix of processes, not on address translation.
Answer: (A)
The following functional dependencies are given:
Which one of the following options is false?
Which one of the following options is false?
Answer: (C)
Find the closure of each side with the given FDs: .
- (A) : adds G, adds A, adds E, adds D. Result . True.
- (B) : adds A, adds C and D. Result . True.
- (D) : adds C and D, adds G. Result . True.
- (C) : adds D, adds E, and adds nothing new. Result . C and G cannot be reached: C is only given by , which needs B, and G is only given by , which needs C. So , and (C) is false.
Answer: (C)
- (A) : adds G, adds A, adds E, adds D. Result . True.
- (B) : adds A, adds C and D. Result . True.
- (D) : adds C and D, adds G. Result . True.
- (C) : adds D, adds E, and adds nothing new. Result . C and G cannot be reached: C is only given by , which needs B, and G is only given by , which needs C. So , and (C) is false.
Answer: (C)
Consider the relations r1(P, Q, R) and r2(R, S, T) with primary keys P and R respectively. The relation contains 2000 tuples and contains 2500 tuples. The maximum size of the join is :
Answer: (A)
The only common attribute of r1 and r2 is R, and R is the primary key of r2. So no two tuples of r2 have the same R value.
Each tuple of r1 has one R value, so it matches at most one tuple of r2. It gives at most one tuple in the join. The join can have no more tuples than r1, which has 2000.
This maximum is reached when every R value in r1 appears in r2. The values 4500 and 5000 are impossible, and 2500 (the size of r2) is not the bound, since each r1 tuple adds at most one row.
Answer: (A)
Each tuple of r1 has one R value, so it matches at most one tuple of r2. It gives at most one tuple in the join. The join can have no more tuples than r1, which has 2000.
This maximum is reached when every R value in r1 appears in r2. The values 4500 and 5000 are impossible, and 2500 (the size of r2) is not the bound, since each r1 tuple adds at most one row.
Answer: (A)
Consider the relation enrolled (student, course) in which (student, course) is the primary key, and the relation paid (student, amount) where student is the primary key. Assume no null values and no foreign keys or integrity constraints. Assume that amounts 6000, 7000,8000,9000 and 10000 were each paid by 20% of the students. Consider these query plans (Plan 1 on left, Plan 2 on right) to "list all courses taken by students who have paid more than x."
A disk seek takes 4 ms, disk data transfer bandwidth is 300 MB/s and checking a tuple to see if amount is greater than x takes 10s . Which of the following statements is correct?
A disk seek takes 4 ms, disk data transfer bandwidth is 300 MB/s and checking a tuple to see if amount is greater than x takes 10s . Which of the following statements is correct?
Answer: (C)
Both plans compute the same thing: the courses of the enrolled students whose amount is more than x. Plan 1 applies the selection on amount before the join and Plan 2 after it, and pushing a selection below a join never changes the result. So (A) is false.
(B) is false. "Project on course" is a relational-algebra projection, which removes duplicate rows, so no course is listed twice.
Cost model: each probe of the index on student needs a disk seek of 4 ms, while checking one tuple against x takes only 10 s, 400 times less. So the number of index probes decides which plan is faster.
(D) is false. For x = 9000, only the students who paid 10000 (20% of them) pass the selection. Plan 1 probes the index for only these 20% of the paid tuples, while Plan 2 probes it for every paid tuple and filters afterwards. So Plan 1 is faster, not slower.
(C) is true. For x = 5000, every amount (6000 to 10000) is more than x, so the selection removes nothing and both plans make the same index probes. They differ only in the checks against x. Plan 1 checks each paid tuple once, during the sequential scan it makes anyway. Plan 2 checks every tuple of the join result, one for each course a paying student takes, and so does at least as many checks when each paying student is enrolled in a course. Plan 1 therefore never does more work and is the faster plan.
Answer: (C)
(B) is false. "Project on course" is a relational-algebra projection, which removes duplicate rows, so no course is listed twice.
Cost model: each probe of the index on student needs a disk seek of 4 ms, while checking one tuple against x takes only 10 s, 400 times less. So the number of index probes decides which plan is faster.
(D) is false. For x = 9000, only the students who paid 10000 (20% of them) pass the selection. Plan 1 probes the index for only these 20% of the paid tuples, while Plan 2 probes it for every paid tuple and filters afterwards. So Plan 1 is faster, not slower.
(C) is true. For x = 5000, every amount (6000 to 10000) is more than x, so the selection removes nothing and both plans make the same index probes. They differ only in the checks against x. Plan 1 checks each paid tuple once, during the sequential scan it makes anyway. Plan 2 checks every tuple of the join result, one for each course a paying student takes, and so does at least as many checks when each paying student is enrolled in a course. Plan 1 therefore never does more work and is the faster plan.
Answer: (C)