PDF Operating System Mcqs Gate - Compress
PDF Operating System Mcqs Gate - Compress
com
YEAR 2001
Question. 1
SOLUTION
Question. 2
SOLUTION
Here the running times r1 ....rn are already known, single processor
system. In this scenario, throughput i.e. CPU is maximum utilized in
shortest job first scheduling.
Hence (B) is correct option.
Question. 3
SOLUTION
Swap space is the memory space where the part of the program not
currently in main memory for execution is stored, this program part
can be swapped into memory when required.
This space is generally in disk.
Hence (B) is correct option.
Question. 4
SOLUTION
Question. 5
SOLUTION
=
58 = 8 Bytes.
8
So total memory = 8 # 1 MB
= 8 MB
Hence (B) is correct option.
Question. 6
Until false;
For the program to guarantee mutual exclusion, the predicate P in
Page 3
CS Topicwise 2001-2010
Operating System [Link]
SOLUTION
While loop if true predicate then the program enters into critical
region. This program enters into critical region of flag [i]=true act
as semaphore, & true =j, the requirement of resource is by some
other process.
Hence (B) is correct option.
YEAR 2002
Question. 7
SOLUTION
Round robin is preemptive since processes are cycled for CPU time,
& run for a particular time stamp in one cycle. Multilevel queue
scheduling maintains various quenes, each having different priorities.
But in FIFO scheme, only the process which enters once, would be
completed first, so no. preemption.
Hence (B) is correct option.
Question. 8
The optimal page replacement algorithm will select the page that
(A) Has not been used for the longest time in the past.
(B) Will not be used for the longest time in the future.
SOLUTION
Question. 9
SOLUTION
Question. 10
SOLUTION
When indexes are created, the maximum no. of blocks given to a file
are totally dependent upon size of the index which tells how many
blocks can be there, & size of each block.
Hence (B) is correct option.
YEAR 2003
Question. 11
Using a larger block size in a fixed block size file system leads to
(A) better disk throughput but poorer disk space utilization
(B) better disk throughput and better disk space utilization
(C) poorer disk throughput but better disk space utilization
(D) poorer disk throughput and poorer disk space utilization
SOLUTION
Using larger block size in a fixed block size system lead to poor disk
space utilization due to data items which are very small comparable
to block size cause fragmentation. But it leads to better
b etter disk through
put since no. of blocks needs to fetch & replace become less.
Hence (A) is correct option.
Question. 12
one-level
practical page tables
because of for virtual to physical address translation is not
(A) the large amount of internal fragmentation
(B) the large amount of external fragmentation
(C) the large memory overhead in maintaining page tables
(D) the large computation overhead in the translation process
SOLUTION
overhead.
Hence (C) is correct option.
Question. 13
A uni-processor
which alternate 10computer
ms CPUsystem
bursts only hasms
with 90 two processes,
I/O boththe
bursts. Both of
processes were created at nearly the same time. The I/O of both
processes can proceed in parallel. Which of the following scheduling
strategies will result in the least CPU utilizations (over a long period
of time) for this system ?
(A) First come first served scheduling
(B) Shortest remaining time first scheduling
(C) Static priority scheduling with different priorities for the two
processes
(D) Round robin scheduling with a time quantum of 5 ms .
SOLUTION
is also 1ns .
Question. 14
SOLUTION
TLB is successfully 96% of total request & for remaining 4%. RAM
is accessed twice.
So average time taken.
= .96 (1 + (0.9 # 1) + 0.1 # (1 + 10))
+ ..0
04 (21 + (.9 # .1)) + 0.1 # (1 + 10)
= .96 (1 + .9 + 1.1) + 0.4 (21 + .09 + 1.1)
= .96 # 3 + 0.4 # 23
= 2.88 + .92
= 3.80 , 4 ns (Nearest .5)
Hence (D) is correct option.
Question. 15
Suppose a process has only the following pages in its virtual address
space; two contiguous code pages starting at virtual address
0 # 0000000, two contiguous data pages starting at virtual address
0 # 00400000,and a stack page starting at virtual address
0 # FFFFF000. The amount of memory required for storing the page
tables of this process is
(A) 8 KB (B) 12 KB
(C) 16 KB (D) 20 KB
SOLUTION
Question. 16
SOLUTION
Question. 17
Which of the following will ensure that the output string never
Page 9
CS Topicwise 2001-2010
Operating System [Link]
SOLUTION
To ensure this
this condition substringg of form 01n 0 oorr 10n 1, where n
condition that substrin
is odd S should be initially 1, we will case only 1 semaphore S.
So at W P (s), at X V (s)
Whereas at Y P (s)
(s),, at Z V (s)
Hence (C) is correct option.
YEAR 2004
Question. 18
SOLUTION
Question. 19
single sequential
algorithm user Come
used is First process at aServed
First time.(FCFS).
The disk head scheduling
If FCFS is replaced
by shortest seek Time Fist (SSTF), claimed by the vendor to given
50% better beachmark results, what is the expected improvement in
the I/O performance of user programs?
(A) 50% (B) 40%
(C) 25% (D) 0%
SOLUTION
effect
reduceofdisk
various other
access t imedevices,
time but no so using SSTFininthe
improvement place of FCFS may
I/O is done.
Hence (D) is correct option.
Question. 20
SOLUTION
Question. 21
Consider the following set of processes, with the arrival times and the
CPU-burst times given in milliseconds
Proc
oceess Arrival ti
time Burst ti
time
Page 11
CS Topicwise 2001-2010
Operating System [Link]
P1 0 5
P2 1 3
P3 2 3
P4 4 1
SOLUTION
Then ar
Then arou
ound
nd ti
time
me = (S
(Sub
ubmi
mitt ti
time
me − fi
fini
nish
sh ti
time
me))
Gantt chart for the scheduler.
P3 = 8−2 = 6
P4 = 5−4 = 1
Total = 22
= 5.5
Hence (A) is correct option.
Question. 22
SOLUTION
Question. 23
Consider two processes P1 and P2 accessing the shared variables X
and Y protected by two binary semaphores Sx and Sy respectively,
both initialized to 1. P and V denote the usual semaphore operators,
where P decrements the semaphore value, and V increments the
semaphore value. The pseudo-code of P1 and P2 is as follows:
P1: :
while true do{ while true do{
:...... :......
:..... :.......
}
}
In ord
order
er to av
avoid
oid dea
deadloc
dlock,k, the cor
correc
rectt opera
operator
torss at L1, L2, L3 and L4
are respectively
(A) P (SY ), P (SX ); P (SX ), P (SY ) (B) P (SX ), P (SY); P (SY ), P (SX )
(C) P (SX ), P (SX ); P (SY ), P (SY ) (D) P (SX ), P (SY ); P (SX ), P (SY )
SOLUTION
Question. 24
A Unix-style I-node has 10 direct pointers and one single, one double
and one triple indirect pointers.
p ointers. Disk block size is 1 Kbyte, disk block
address is 32 bits, and 48-bit integers are used.
used . What is the maximum
possible file size?
(A) 224 bytes (B) 232 bytes
(C) 234 bytes (D) 2 48 bytes
SOLUTION
Size of 1 block = 1 kB
Block addresses size 1 pointer size = 32 bit
= 4 bytes.
10
So no. of pointers in = 2 2 B
2B
1 block = 256
So direct pointer will have = 10 # 1kB = 10kB
Double will have = 256 # 256 # 1 kB
Triple will have = 256 # 256 # 256 # 1 kB
8 8 8 10
= 2 #2 #2 #2 B
34
= 2 B
Hence (C) is correct option.
YEAR 2005
Question. 25
SOLUTION
Question. 26
SOLUTION
Initial value of a is let 10 and its address & a would be different for
both parent & child process so.
(A) & (B) are incorrect also parent process executes a = a − 5 = 5 = u
& child executes a = a + 5 = 15 = x so u + 10 = x
Hence (D) is correct option.
YEAR 2006
Question. 27
(C) 3 (D) 4
SOLUTION
Question. 28
The atomic
memory feth-and-set
location x, yfetches
x to 1 and instruction
the oldunconditionally
value of x in y sets the
without
allowing any intervening access to the memory location x . Consider
the following implementation of P and V functions on a binary
semaphore S.
void p (binary_semaphore*S){
unsigned y;
unsigned*x =& (S->value);}
do {
fetch-and-set x,y;
} while(y);
}
void V (binary_semphore*S){
{S_>value = 0;
}
Which one of the following is true?
(A) The implementation may not work if context switching is disabled
in P
(B) Instead of using fetch-and-set, a pair of normal load/store can
be used
SOLUTION
If there are more than two processes and context & switching processes
is disabled in P then this implementation doesn’t work properly and
can’t synchronize the processes.
Question. 29
A CPU generates 32-bit virtual addresses. The page size is 4 KB. The
processor has a translation look-aside buffer (TLB) which can hold a
total of 128 page table entries and is 4-way set associative.
The minimum size of the TLB tag is
(A) 11 bits (B) 13 bits
(C) 15 bits (D) 20 bits
SOLUTION
TLB has 128 page table enteries, each page table would have. 64 bits
i.e. 32 + 32 virtual addresses.
So total memory required.
27 # 26
But 4 way set associative.
27 # 26 = 211
22
Question. 30
SOLUTION
Since both virtual and physical memory has 32 bit addresses, so there
is no need for address translation hardware is required.
Hence (C) is correct option.
Question. 31
SOLUTION
Process id 0 1 2
CPU burst 2 4 8
So we draw Gantt chart for scheduler
Question. 32
SOLUTION
Proc
oces
esss First I/0 Com
ompu
puta
tati
tion
on Se
Seco
cond
nd I/0 Total
2 7 1 10
2 4 14 2 20
3 6 21 3 30
Since I/0 can be done parallely.
Gantt chart
= 10.6%
Hence (B) is correct option.
Question. 33
SOLUTION
Void barrier(void) {
1 : P(S)
2 : Process_arrived++;
3 : V (S) :
4 : while (process_arrived’=3);
5 : P(S);
6 : Precess_left++;
7 : if(process_left==3)
8 : process_arrived=0;
9 : process_left+0;
10 : }
11 : V(S);
}
Page 20
CS Topicwise 2001-2010
[Link] Operating System
Question. 34
SOLUTION
Question. 35
SOLUTION
This
Henceremoves any deadlock
(B) is correct [Link].
YEAR 2007
Question. 36
SOLUTION
Question. 37
Consider the following statements about user level threads and kernel
level threads. Which one of the following statements is FALSE?
(A) Context switch time is longer for kernel level threads than for
user level threads
(B) User level threads do not need any hardware support
(C) Related kernal level thread can be scheduled on different
processors in a multiprocessor system
Page 22
CS Topicwise 2001-2010
[Link] Operating System
(D) Blocking one kernel level thread blocks all related threads
SOLUTION
Question. 38
SOLUTION
P2 came at t = 15
Scheduled first time at t = 20 wait = 5 .
Wait between t = 30 & t = 40 due to short remaining time of new
process P3 .
Wait now = 5 + 10 = 15
Then complete at t = 55
Page 23
CS Topicwise 2001-2010
Operating System [Link]
Question. 39
replacement policy
process. Consider theand allocates
following a fixed number of frames to a
statements:
P: Increasing the number of page frames allocated to a process
sometimes increases the page fault rate.
Q: Some program do not exhibit locality of reference.
Which one of the following is TRUE?
(A) Both P and Q are ture, and Q is the reason for P
(B) Both P and Q are true, but Q is not the reason for P
(C) P is false, but Q is true
(D) Both P and Q are false
SOLUTION
Question. 40
(A) P0
(B) P1
(C) P2
(D) None of the above, since the system is in a deadlock
SOLUTION
Initially.
Process Allow Request/need Available
XYZ XYZ XYZ
P0 121 103 012
P1 121 012
P2 221 120
Question. 41
Here, wants 1 and wants 2 are shared variables, Which are initialized
to false. Which one of the following statements is TRUE about the
Page 25
CS Topicwise 2001-2010
Operating System [Link]
above construct?
(A) It does not ensure mutual exclusion.
(B) It does not ensure bounded waiting.
(C) It requires that processes enter the critical section in strict
alternation.
(D) It does not prevent deadlocks, but ensures mutual exclusion
SOLUTION
Question. 42
SOLUTION
Reference string 1, 2, 1, 3, 7, 4, 5, 6, 3, 1
Using optimal replacement policy, we will replace that page in memory
which either will not be used or latest used in future.
Page 26
CS Topicwise 2001-2010
[Link] Operating System
Question. 43
SOLUTION
Difference = 9−7 = 2
Hence (C) is correct option.
Page 27
CS Topicwise 2001-2010
Operating System [Link]
YEAR 2008
Question. 44
SOLUTION
Question. 45
The data block of a very large file in the Unix file system are allocated
allo cated
using
(A) Contiguous allocation
(B) Linked allocation
(C) indexed allocation
(D) an extension of indexed allocation
SOLUTION
Question. 46
V (s): s = s + 1;
ifs <= 0 then wakeup a process waiting on s ;
Page 28
CS Topicwise 2001-2010
[Link] Operating System
SOLUTION
Question. 47
(D) In the case of synchronous I/O, the process waiting for the
completion of I/O is woken up by the ISR that is invoked afterr
the completion of I/O
SOLUTION
Question. 48
SOLUTION
Question. 49
Page 30
CS Topicwise 2001-2010
[Link] Operating System
SOLUTION
The loop is called for n times. The first process is parent process so
this should not be
b e counted in child process. But after
aft er that every child
process has its own child created so after every loop.
0 n
2 , 2',..
,.........2 total threads.
But subtracting the parent.
Hence (B) is correct option.
Question. 50
: bits 21-29 are used to index into second level page table
: bits 12-20 are used to index into third level page table
: bits 0-11 are used as offset within the page
The number of bits required for addressing the next level page table
(or page frame) in the page table entry of the first, second and third
level page table are respectively
respect ively..
(A) 20,20 and 20 (B) 24,24 and 24
(C) 24,24 and 20 (D) 25,25 and 24
SOLUTION
YEAR 2009
Question. 51
SOLUTION
Tot
otal
al re
reso
sour
urces
ces = 3 2 3 2
Proc
Proceess 1 Proc
oces
esss 2 Proc
oceess 3 Avai
aillable
Time 1 2 3 4 1234 1234 1234
0 0200 0020 0001 3011
1 0210 0020 0001 3001
2 0210 0021 2001 1000
3 0210 0021 2001 1000
4 0210 1021 2001 0000
5 1110 1021 0001 1100
6 1110 1011 0001 1110
7 1100 1011 0101 1020
8 1100 0000 0111 2021
9 1102 0000 0000 2130
10 0000 0000 0000 3232
All process computed without deadlock
Hence (A) is correct option.
Page 32
CS Topicwise 2001-2010
[Link] Operating System
Question. 52
SOLUTION
Question. 53
SOLUTION
Question. 54
Consider a disk system with 100 cylinders. The requests to access the
cylinders occur in following sequence :
4, 34, 10, 7, 19, 73, 2, 15, 6, 20
Assuming that the head is currently at cylinder 50, what is the time
taken to satisfy all requests if it takes 1 ms to move from one cylinder
to adjacent one and shortest seek time first policy is used ?
SOLUTION
Arranging in order.
Total 16 + 14 + 1 + 4 + 5 + 3 + 1 + 2 + 2 + 71
=
= 119 ms
Hence (B) is correct option.
Question. 55
In the following process state transition diagram for a uniprocessor
system, assume that there are always some processes in the steady
state :
SOLUTION
Question. 56
SOLUTION
Question. 57
A multilevel
page table forpage table isvirtual
translating preferred in comparison
address to physical to a single
address level
because
(A) It reduces the memory access time to read or write and memory
location
(B) It helps to reduce the size of page table needed to implement the
virtual address space of a process
(C) If is required by the translation lookaside buffer
(D) If helps to reduce the number of page faults in page replacement
algorithms.
SOLUTION
Single level page table is not preferred since it requires the no. of
page table enteries equal to the no. of virtual memory addresses, but
a multilevel page table has smaller no. of enteries so reduce the size
of page table needed.
Hence (B) is correct option.
YEAR 2010
Question. 58
SOLUTION
Question. 59
A system uses FIFO policy for page replacement. It has 4 page frames
with no pages loaded to begin with . The system first accesses 100
distinct pages in some order and then accesses the same 100 pages
but now in the reverse order .How many page faults will occur ?
(A) 196 (B) 192
(C) 197 (D) 195
SOLUTION
In FIFO page replacement policy, the pages which entered first are
replaced first so for first 100 accesses, 100
1 00 page faults will occur. Now
N ow
th
in memory there are last 4 pages 97, 98, 99 & 100 page.
So during reverse access there 4 pages would not create any page
fault & other 97 page faults.
So total 100 + 96 = 196 page faults.
Hence (A) is correct option.
Question. 60
SOLUTION
Question. 61
release (S1 );
release (S2 );
}
How many times will precess P0 print ‘0’ ?
(A) At least twice (B) Exactly twice
(C) Exactly thrice (D) Exactly once
SOLUTION
Question. 62
Page 38
CS Topicwise 2001-2010
[Link] Operating System
if (i%2==0){
if(i<n)request i ;
if(i+2<n)request i + 2;
else {
if (i<n)request n ;
if (i+2<n)request n i 2;
SOLUTION
So for P10 only R10 can be allotted whereas for P11 odd case (else).
This is an conflict.
Page 39
By NODIA and Company
Available
Available in Two
Two Volumes
Volumes