GATE 2003
107 questions
MCQ 1071-mark 107
Questions 96–100 of 107
A processor uses 2-level page tables for virtual to physical address translation. Page tables for both levels are stored in the main memory. Virtual and physical addresses are both 32 bits wide. The memory is byte addressable. For virtual to physical address translation, the 10 most significant bits of the virtual address are used as index into the first level page table while the next 10 bits are used as index into the second level page table. The 12 least significant bits of the virtual address are used as offset within the page. Assume that the page table entries in both levels of page tables are 4 bytes wide. Further, the processor has a translation look-aside buffer (TLB), with a hit rate of 96%. The TLB caches recently used virtual page numbers and the corresponding physical page numbers. The processor also has a physically addressed cache with a hit rate of 90%. Main memory access time is 10 ns, cache access time is 1 ns, and TLB access time is also 1 ns.
Assuming that no page faults occur, the average time taken to access a virtual address is approximately (to the nearest 0.5 ns)
Assuming that no page faults occur, the average time taken to access a virtual address is approximately (to the nearest 0.5 ns)
Answer: (D)
The cache is physically addressed, so every access needs a translation first. Assume page-table entries are read directly from main memory, and main memory is read only after a cache miss.
TLB: accessed every time, 1 ns.
TLB miss (4%): two page-table reads from memory, ns.
Cache and memory: ns. (A miss costs the cache check plus the memory access.)
Average = ns, which is 4 ns to the nearest 0.5 ns.
Answer: (D)
TLB: accessed every time, 1 ns.
TLB miss (4%): two page-table reads from memory, ns.
Cache and memory: ns. (A miss costs the cache check plus the memory access.)
Average = ns, which is 4 ns to the nearest 0.5 ns.
Answer: (D)
In a system with 32 bit virtual addresses and 1 KB page size, use of one-level page tables for virtual to physical address translation is not practical because of
Answer: (C)
A one-level page table needs one entry per virtual page: entries. With 4 bytes per entry that is 16 MB for every process, and it must stay in memory. This is a large memory overhead.
(A) Internal fragmentation is the unused part of a process's last page, at most one page. It does not depend on the number of page-table levels, and with 1 KB pages it is small.
(B) Paging has no external fragmentation, because all frames are the same size.
(D) Translation is one table lookup and an addition of the offset. The time cost is not the problem.
Answer: (C)
(A) Internal fragmentation is the unused part of a process's last page, at most one page. It does not depend on the number of page-table levels, and with 1 KB pages it is small.
(B) Paging has no external fragmentation, because all frames are the same size.
(D) Translation is one table lookup and an addition of the offset. The time cost is not the problem.
Answer: (C)
Consider the set of relations shown below and the SQL query that follow:
Students:(Roll_number,Name,Date_of_birth)
Courses:(Course_number,Course_name,Instructor)
Grades:(Roll_number,Course_number,Grade) select distrinct Name
from Students, Courses, Grades
Where Students.Roll_number=Grades.Toll_number
and Courses.Instructor= 'Korth'
and Courses.Course_number=Grades.Course_number
and Grades.grade= 'A' Which of the following sets is computed by the above query?Answer: (C)
The query joins Students, Courses and Grades, and keeps a row only when the course is taught by Korth, the grade in that row is 'A', and the student matches the grade. (The words "distrinct" and "Toll_number" are typing slips for distinct and Roll_number.)
One such row is enough to put the student's Name in the output, and distinct removes repeated names. So the output is the names of students who got an A in at least one course taught by Korth.
"All courses taught by Korth" (A) would need a division, or a not exists check that no Korth course is missing an A. This query has no such check. (B) is wrong because the query tests only Korth's courses, not all courses. (D) is wrong because (C) is correct.
Answer: (C)
One such row is enough to put the student's Name in the output, and distinct removes repeated names. So the output is the names of students who got an A in at least one course taught by Korth.
"All courses taught by Korth" (A) would need a division, or a not exists check that no Korth course is missing an A. This query has no such check. (B) is wrong because the query tests only Korth's courses, not all courses. (D) is wrong because (C) is correct.
Answer: (C)
Consider the following SQL query
select distinct
from
where P
For an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions?
A.
B.
C.
D.
select distinct
from
where P
For an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions?
A.
B.
C.
D.
Answer: (A)
Translate each clause of the query:
- from lists several relations, which is a cross product: .
- where P is the selection on that product.
- select distinct is the projection , which also removes duplicate tuples.
So the query is , which is expression A.
B is wrong because a natural join keeps only tuples that agree on common attributes, and the from list does not ask for that. C and D are wrong because union and intersection need relations with the same attributes and do not combine the attributes of different relations.
Answer: (A)
- from lists several relations, which is a cross product: .
- where P is the selection on that product.
- select distinct is the projection , which also removes duplicate tuples.
So the query is , which is expression A.
B is wrong because a natural join keeps only tuples that agree on common attributes, and the from list does not ask for that. C and D are wrong because union and intersection need relations with the same attributes and do not combine the attributes of different relations.
Answer: (A)
Consider the following functional dependencies in a database:
The relation (Roll_number,Name,Date_of_Birth,Age) is
The relation (Roll_number,Name,Date_of_Birth,Age) is
Answer: (D)
Only three of the given FDs hold for this relation:
- Date_of_Birth Age
- Name Roll_number
- Roll_number Name
The candidate keys are (Date_of_Birth, Name) and (Date_of_Birth, Roll_number).
Here we see a partial dependency (Date_of_Birth Age), and Age is not a prime attribute. So the relation is only in 1NF.
The answer is option (D).