Operating Systems Test - 4 - PDF Flipbook

Operating Systems Test - 4

326 Views
38 Downloads
PDF 5,053,090 Bytes

Download as PDF

REPORT DMCA


GATE
CSE

Operating
systems

Test-04Solutions


OPERATING SYSTEMS

1. Consider n processes sharing the CPU in a round-robin fashion.

Assuming that each process switch takes s seconds, what must

be the quantum size q such that the overhead resulting from

process switching is minimized but, at the same time each

process is guaranteed to get its turn at the CPU at least every t

seconds?

a) q ≤ t−ns
n−1

b) q ≥ t−ns
n−1

c) q ≤ t−ns
n+1

d) q ≥ t−ns
n+1

Answer: (a)

2. 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.

c) Has been used least number of times.

d) Has been used most number of times.

Answer: (b)

3. if the disk head is located initially at 32, find the number of disk

moves required with FCFS if the disk queue of l/O blocks

Requests are,98,37, 124,65,67

a) 239

b) 310

1


c) 321
d) 325
Answer :(c)
Solution:
Given, sequence is: 98, 37, 14, 124, 65, 67
Using FCFS (first come first serve) disk scheduling

Total disk moves = (98 ‒ 32) + (98 ‒ 37) + (37 ‒ 14) + (124 ‒
65) + (67 ‒ 65) = 321
4. Consideradiskwith'l6384bytespertrackhaving a rotation time of
16 m sec and average seek time of 40 msec. what is the time in
msec to read a block of 1024 byte from this disk?
a) 57 msec
b) 49 msec
c) 48 msec
d) 17 msec
Answer: (b)
Solution:
Given, seek time = 40 msec
Rotational delay = 16 msec
Total block size to be read = 1024 bytes
Disk size = 16384 bytes

2


Therefore, average rotational latency = rotational latency
2

= 16 = 8 m sec
2

Total transfer time = 1024 *16 = 1 msec
16384

Total transfer time = 40 + 8 + 1 = 49 msec

5. Consider an arbitrary set of CPU-bound processes with unequal

CPU burst lengths submitted at the same time to a computer

system. Which one of the following process scheduling

algorithms would minimize the average waiting time in the

ready queue?

a) Shortest remaining time first

b) Round-robin with time quantum less than the shortest CPU

burst

c) Uniform random

d) Highest priority first with priority proportional to CPU burst

length

Answer: (a)

Solution:

SRTF is the optimal algorithm with respect to Throughput and

Waiting Times

6. Reliability of software is directly dependent

a) quality of the design

b) number of errors present

c) software engineers experience

d) user requirement

3


Answer: (b)
Solution:
Software reliability is measured in terms of MTBF (mean time
between failures). Reliability of software is a number between 0
an d 1 reliability increases when errors or bugs from the
program are removed
7. A semaphore count of negative n means (s = -n) that the queue
contains means waiting process.
a) n + 1
b) n
c) n – 1
d) 0
Answer: (b)
Solution:
If someone requests a room and the resulting value of the
semaphore would be negative, they are forced to wait until a
room is freed (when the count is increased from 0, that means
semaphore value 0 indicates no process is waiting for room)
Semaphore value negative (S = – n) means the queue contains n
process in waiting
8. Consider the C function foo and bar given below:
int foo (int val)
{
int x =0;
while (val >0)

4


{ x =x +foo (val --);
{
}
return val }
int bar (int val)
{
int x =0;
while (val >0)
{
x = x+ bar (val-1);
}
return val;
}
invocations of foo (3) and bar (3) will result m:
a) Return of 6 and 6 respectively
b) Infinite loop and abnormal termination respectively
c) Abnormal termination and infinite loop respectively
d) Both terminating abnormally
Answer: (c)
Solution:
In the function foo( ), every time in the while loop, foo( ) is
called with, the value '3' because val is passed with the post
decrement operator. So the value '3' is passed and val is
decremented later. Every time the function is called a new
variable is created as the passed variable is passed by value with

5


the value '3' so the function will close abruptly without returning
any value.
In the function bar( ), in the while loop value of val variable is
not decrementing, it remains 3 only, bare ) function in the while
loop is called with val-1, i.e, 2 but value of val is not
decremented so it will result an infinite loop.
9. The data hiding is taken care by:
a) Abstraction
b) Encapsulation
c) Modularity
d) Inheritance
Answer: (a)
Solution:
Abstraction is hiding the implementation details by providing a
layer over the basic functionality
Encapsulation is just grouping all similar data and functions into
a group e.g., class in programming, packet in networking
10. Consideradiskwith'l6384bytespertrackhaving a rotation time of
16 m sec and average seek time of 40 msec. what is the time in
msec to read a block of 1024 byte from this disk?
a) 57 msec
b) 49 msec
c) 48 msec
d) 17 msec
Answer: (b)

6


Solution:

Given, seek time = 40 msec

Rotational delay = 16 msec

Total block size to be read = 1024 bytes

Disk size = 16384 bytes

Therefore, average rotational latency = rotational latency = 16
2 2

= 8 m sec

Total transfer time = 1024 *16 = 1m sec
16384

Total transfer time = 40 + 8 + 1 = 49 msec

11. The correct matching for the following

List - I List - II

a) Disk scheduling (1) Round robin

b) Batch processing (2) SCAN

c) Time sharing (3) LIFO

d) Interrupt processing (4) FIFO

a) a-3, b-4, c-2, d-1

b) a-4, b-3, c-2, d-1

c) a-2, b-4, c-1, d-3

d) a-3, b-4, c-3, d-2

Answer: (c)

12. When a language has the capability to produce new data types,

it is said to be:

a) extensible

b) encapsulated

7


c) overloaded

d) none of the above

Answers: (a)

13. A system has four processes and five allocable resources the

current allocation and maximum needs are as follows:

Allocated Maximum Available

Process A 1 0 2 1 1 1 1 2 1 3 0 0 x 1 1

Process B 2 0 1 1 0 2 2 2 1 0

Process C 1 1 0 1 0 2 1 3 1 0

Process D 1 1 1 1 0 1 1 2 2 1

The smallest value of x for which the above system in safe state

is

a) 1

b) 3

c) 2

d) 0

Answer: (c)

Solution:

Remaining need = maximum – allocated

Allocated Maximum Available Remaining needs

A 10211 11213 00x11 01002

B 20110 22210 02100

C 11010 21310 10300

D 11110 11221 00111

If x = 0, then no process satisfied remaining needs

8


If x = 1, then only process satisfied remaining needs
If x = 2, then only process will be exicuted as safe sequence is
D, C, B, A
14. CDMA Cell uses carriers of 1.25 MHZ.
a) 9
b) 18
c) 2
d) 64
Answer: (a)
Solution:
Nine carriers of 1.25 mhz by cdma cells
15. Which of the following will ensure that the output string never
contains a substring of the form 01n 0 or 10n 1 where n is odd?
a) P(S) at W, V(S) at X,P(T) at Y, V(T) at Z, S and T initially 1
b) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1
c) P(S) at W, V(S) at X, P(S) at Y, v(S) at Z, S initially 1
d) V(S) at W, V(T) at X, P(S) at Y, P(T) at Z,S and T initially 1.
Answer: (c)
Solution:
Applying definitions of down & up operations of semaphores;
with initial values of 1 & 0 respectively.

9


16. A CPU handles interrupt by executing interrupt service
subroutine
a) by checking interrupt register after execution of each
instruction
b) by checking interrupt register at the end of the fetch cycle
c) whenever an interrupt is registered
d) by checking interrupt register at regular time interval
Answer: (a)
Solution:
Hardware detects interrupt immediately but cpu acts only after
its current instruction this is followed to ensure integrity of
instruction

17. For a data entry project for office staff who have never used
computers before (user interface and user friendliness are
extremely important), one will use
a) Spiral model
b) Component based model
c) Prototyping
d) Waterfall model
Answer: (d)
Solution:
Software prototyping is the activity of creating prototypes of
software applications i.e., incomplete versions of the software
program being developed. It is an activity that can occur in

10


software development and is comparable to prototyping as know
from other fields such as mechanical or manufacturing
The spiral model is a risk driven process model
18. Assertion (A): Bit maps are not often used in memory
management.
Reason (R): Searching a bit map for a run of given length is a
slow operation.
a) Both (A) and (R) are true and (R) is correct explanation for

(A)
b) Both (A) and (R) are true but (R) is not correct explanation

for(A)
c) (A) is true (R) is false
d) (A) is false (R) is true
Answer: (a)
Solution:
Bitmap are not used in memory management because searching
a bit map of large length take very long time
19. Match the following for Windows Operating System:
List-I
A. Hardware abstraction layer
B. Kernel
C. Executive
D. Win32 subsystem

11


List-II
1. Starting all processes, emulation of different operating

systems, security functions' transform character-based
applications to graphical representation.
2. Export a virtual memory interface, support for symmetric
multiprocessing, administration' details of mapping memory,
configuring l/O buses, setting up DMA.
3. Thread scheduling, interrupt and exception handling,
recovery after power failure'
4. Object manager, virtual memory manager' process manager,
plug- and-play and power manager
Codes:
ABCD
a) 1 3 2 4
b) 4 3 2 1
c) 2 3 4 1
d) 3 2 1 4
Answer: (c)
20. Suppose that the number of instructions executed between
page fault is directly proportional to the number of page frames
allocated to a program. if the available memory is doubled, the
mean interval between page faults is also doubled. Further,
consider that a normal instruction takes one microsecond, but if
a page fault occurs, it takes seconds. if a program takes 60 secs

12


to run, during which time it gets 15,000-page faults, how long

would it take to run if twice as much memory were available?

a) 60 sec

b) 30 sec

c) 45 sec

d) 10 sec

Answer: (c)

Solution:

Ninst *1s + 15000* 2000s = 60s

Ninst *1s = 60000000 ‒ 30000000 = 30000000

The number of instructions between two page fault is

30000000
15000


= = 2000

If the mean interval between page fault is doubled the number of

instruction between two page faults is also doubled and is 4000

now the number of page default is 30000000/4000 = 75000

T = 30000000s + 7500*2000s

= 30000000s + 750002000s = 4500000s = 45s

21. Assuming that the disk head is located initially at 32, find the

number of disk moves required with FCFS if the disk queue of

l/O block requests are 98, 37, 14, 124, 65, 67:

a) 310

b) 324

c) 320

d) 321

Answer:(d)

13


Solution:
Given request is : 98, 37, 14, 124, 65, 67
Using FCFS(first come first serve) disk sheduling

So, total number of disk moves = 66+84+110+59+2 =321
22. In which file the compiler manage the various objects, which

are used in windows programming?
a) Control File
b) Binary File
c) Text File
d) Object File
Answer: (c)
Solution:
Text files are stored in a from (usually ASCII) that is human
readable.
Control file is a small binary file that records the physical
structure of the database
A binary file is computer reachable but not human readable
Object file, and organized machine code file created by a
computer
Microsoft windows test files are identified with the .txt file
extension

14


23. A program is located in the smallest available hole in the
memory is
a) best-fit
b) first-bit 46'
c) worst-fit
d) buddy
Answer: (a)
Solution:
In best fit is the allocation technique that place a process in the
smallest block of allocated memory in which it will fit
In worst fit place process in the largest block of unallocated
memory available
In the first memory manager place the process in the first block
of unallocated memory available

24. Locality of reference implies that the page reference being
made by a process
a) Will always be to the page used in the previous page
reference
b) Is likely to be to one of the pages used in the last few page
references
c) Will always be to one of the pages existing in memory
d) Will always lead to page fault
Answer: (b)

15


Solution:
locality of reference, also known as the principle of locality, is
the phenomenon of the same value or related storage locations
being frequently accessed. There are two basic types of
reference locality. Temporal locality refers to the reuse of
specific data and/or resources within relatively small time
durations. Spatial locality refers to the use of data elements
within relatively close storage locations. Sequential locality, a
special case of spatial locality, occurs when data elements are
arranged and accessed linearly,
e.g., traversing the elements in a one-dimensional array.
Thrashing
25. Which level of Abstraction describes how data are stored in the
data base?
a) Physical level
b) View level
c) Abstraction level
d) Logical level
Answer: (a)
Solution:
Physical level: this is the lowest level of data abstraction. It
describes how data is actually stored in database. You can get
the complex data structure details at this level
Logical level: this is the middle level of 3- level data abstraction
architecture

16


Abstraction layer is a way of hiding the functionality allowing
the separation of concerns to facilitate interpretability and
platform independence
26. Suppose a disk has 201 cylinders, numbered from 0 to 200. At
some time the disk-arm is at cylinder 100, and there is a queue
of disk access requests for cylinders 30, 85, 90, 100, 105, 110,
135 and 145. If Shortest-Seek Time First (SSTF) is being used
for scheduling the disk access, the request for cylinder 90 is
serviced after servicing ______ number of requests.
Answer: 3
Solution:
From the current position 100 it will serve the requests in the
order 100, 105, 110 and then 90.
27. An SRS
a) Establishes the basis for agreement between client and the

supplier.
b) Provides a reference for validation of the final product.
c) is a prerequisite to high quality software?
d) All of the above.
Answer: (d)
Solution:
An SRS (software requirements specifications developments) is
a description of software system to be developed. It lays out
functional and non-functional requirements, and may include a

17


set of use cases that describes user interactions that the software
must provide
28. A system uses 3 page frames for storing process pages in main
memory. It uses the Least Recently Used (LRU) page
replacement policy. Assume that all the page frames are initially
empty. What is the total number of page faults that will occur
while processing the page reference string given below?
4, 7, 6, 1, 7, 6, 1, 2, 7, 2
a) 4
b) 5
c) 6
d) 7
Answer: (c)
Solution:
Assuming pure demand paging initially the first three references
causes page-faults and from the remaining references using
LRU policy three more page fault occurs making the count to 6.
29. in Unix, the login prompt can be changed by changing the
contents of the file
a) contrab
b) init
c) gettydefs
d) inittab
Answer: (c)

18


Solution:
The crontab is a list of commands that you want to run on a
regular schedules, init (short for initialization) is the first process
started during booting of the system. In it is a daemon process
that continues running until the system is shut down, it is parent
of all processes
Each time you change the gettydefs file, you should run getty-c
gettdefs, which checks the syntax of the file to make sure that all
entries are valid
30. In CSMA protocol, after the station finds the line idle, it sends
or refrains from sending based on the outcome of a random
number generator.
a) Non-persistent
b) 0-persistent
c) 1-persistent
d) p-persistent
Answer: (d)
Solution:
in P-persistent CSMA protocol, when station found channel idle,
then it sends or refrain from sending based on probability P

19


Data Loading...