GATE 2011
81 questions
MCQ 811-mark 40 · 2-mark 41
Questions 46–50 of 81
Let the time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE?
Answer: (C)
Switching between processes needs a mode switch and also saving and restoring the full process context (registers, memory map, TLB effects). So it takes more time than a mode switch alone.
Answer:
Answer:
Consider the following table of arrival time and burst time for three processes P0, P1 and P2.
The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?
The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?
Answer: (A)
Waiting time = completion time arrival time burst time. Preemptive SJF picks the process with the least remaining time, but only when a process arrives or finishes.
- 0-1: P0 runs (8 ms left).
- t = 1: P1 arrives with 4, less than P0's 8, so P1 preempts and runs 1-5.
- t = 2: P2 arrives with 9, more than P1's remaining 3, so there is no preemption.
- t = 5: P1 is done. P0 (8) is shorter than P2 (9), so P0 runs 5-13.
- 13-22: P2 runs.
Waiting times:
P0 = 13 0 9 = 4
P1 = 5 1 4 = 0
P2 = 22 2 9 = 11
Average = (4 + 0 + 11) / 3 = 5 ms
Answer: (A)
- 0-1: P0 runs (8 ms left).
- t = 1: P1 arrives with 4, less than P0's 8, so P1 preempts and runs 1-5.
- t = 2: P2 arrives with 9, more than P1's remaining 3, so there is no preemption.
- t = 5: P1 is done. P0 (8) is shorter than P2 (9), so P0 runs 5-13.
- 13-22: P2 runs.
Waiting times:
P0 = 13 0 9 = 4
P1 = 5 1 4 = 0
P2 = 22 2 9 = 11
Average = (4 + 0 + 11) / 3 = 5 ms
Answer: (A)
Let the page fault service time be 10ms in a computer with average memory access time being 20ns. If one page fault is generated for every memory accesses, what is the effective access time for the memory?
Answer: (B)
Effective access time:
EAT =
Page fault term: , so EAT 20 + 10 = 30 ns
Answer: 30 ns
EAT =
Page fault term: , so EAT 20 + 10 = 30 ns
Answer: 30 ns
Consider a relational table with a single record for each registered student with the following attributes.
1. Registration_Number: Unique registration number for each registered student
2. UID: Unique Identity number, unique at the national level for each citizen
3. BankAccount_Number: Unique account number at the bank. A student can have multiple accounts or joint accounts. This attributes stores the primary account number
4. Name: Name of the Student
5. Hostel_Room: Room number of the hostel
Which of the following options is INCORRECT?
1. Registration_Number: Unique registration number for each registered student
2. UID: Unique Identity number, unique at the national level for each citizen
3. BankAccount_Number: Unique account number at the bank. A student can have multiple accounts or joint accounts. This attributes stores the primary account number
4. Name: Name of the Student
5. Hostel_Room: Room number of the hostel
Which of the following options is INCORRECT?
Answer: (A)
A joint account can be the primary account of more than one student. So BankAccount_Number need not be unique, and it is not a candidate key. Option (A) is INCORRECT.
- (B) Registration_Number is unique, so it can be a primary key.
- (C) UID is unique at the national level, so if all students are from the same country it is unique among them and is a candidate key.
- (D) If you add attributes to a super key, it stays a super key. So is a super key.
Answer: (A)
- (B) Registration_Number is unique, so it can be a primary key.
- (C) UID is unique at the national level, so if all students are from the same country it is unique among them and is a candidate key.
- (D) If you add attributes to a super key, it stays a super key. So is a super key.
Answer: (A)
Consider a relational table r with sufficient number of records, having attributes and let . Two queries Q1 and Q2 are given below.
where c is a constant
where and are constants
The database can be configured to do ordered indexing on or hashing on .
Which of the following statements is TRUE?
where c is a constant
where and are constants
The database can be configured to do ordered indexing on or hashing on .
Which of the following statements is TRUE?
Answer: (C)
Let us look at each query in turn:
- Q1 is an equality search. A hash index can find the record in about one access. This is faster than going down a tree.
- Q2 is a range search. Hashing spreads the values out, so it cannot handle a range. An ordered index can handle it.
Answer: Hashing will outperform ordered indexing on Q1, but not on Q2
- Q1 is an equality search. A hash index can find the record in about one access. This is faster than going down a tree.
- Q2 is a range search. Hashing spreads the values out, so it cannot handle a range. An ordered index can handle it.
Answer: Hashing will outperform ordered indexing on Q1, but not on Q2