0% found this document useful (0 votes)
27 views8 pages

BITS Pilani OS Mock Test Questions

The document contains a mock test for operating systems with 20 multiple-choice questions covering topics such as process synchronization, memory management, deadlock, and disk scheduling. Each question provides options for answers, testing knowledge on various OS concepts. The test is designed for individuals preparing for exams or assessments in operating systems.

Uploaded by

Kow
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

BITS Pilani OS Mock Test Questions

The document contains a mock test for operating systems with 20 multiple-choice questions covering topics such as process synchronization, memory management, deadlock, and disk scheduling. Each question provides options for answers, testing knowledge on various OS concepts. The test is designed for individuals preparing for exams or assessments in operating systems.

Uploaded by

Kow
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OS Mock Test

Q1. Calculate how many surfaces will be required to store 336,000 logical
records using the following information.
• Each record size is 140 bytes
• Each sector size is 1024 bytes
• Each track has 96 sectors
• Each surface has 100 tracks
• Records cannot span two sectors.

(a) 3
(b) 5
(c) 7
(d) None of these

Q2. Consider the following two concurrent processes Pi and Pj (turn is global
variable)

Pi Pj
while (turn!=i); while (turn!=j);
<critical section> <critical section>
turn = j; turn = i;

Assume initially turn = i. if Pi and Pj executes the above code then


which of the following will not hold by them?
(a) Mutual exclusion
(b) Progress
(c) Bounded wait
(d) None of these
Q3. Assume P1 and P2 are two concurrent processes and that the following
data are shared between processes and initialized as indicated prior to
execution:
Semaphore m = 1;
Semaphore n = 1;
int x = 0;
int y = 0;
Here x and y are shared resources. If one process accessing the data of x
then process can access the data of y but both processes can not access
the same shared resource simultaneously.
Consider the following programs for P1 and P2:

What is the output of the select statement?


(a) Deadlock and No race condition
(b) Deadlock and race condition
(c) No Deadlock and No race condition
(d) Race condition and No Deadlock
Q4. Consider a paging system with a 32-bit virtual address space. Each
address refers to a byte in memory.
Let the page size be 16 KB, and the main memory size be 256 MB.
What is minimum size of page table? Assume page table entry has
atleast 2 protection bits.
(a) 0.5 MB
(b) 1 MB
(c) 1.3 MB
(d) None of these

Q5. A bit vector can be used to keep track of which blocks are free in a file
system’s partition on disk. Assuming a 1 kilobyte block size, and a disk
size of 40 gigabytes, how big would the bit vector have to be?
(a) 5 MB
(b) 10 MB
(c) 40 MB
(d) 25 MB

Q6.
Q7. A fork system call will fail, if
(a) The previously executed statement in the program is also a fork call.
(b) After fork() both the parent and the child are executing the same
program.
(c) The limit on the maximum number of processes that can be under
execution by a single user exceeds.
(d) All of the above

Q8. The disk has 60 cylinders and the disk head is currently positioned over
cylinder 20. Disk requests come into the disk drive for cylinders: 10,
22, 20, 2, 40, 6, 38 in that order. If a seek takes 6ms per cylinder moved,
find the total seek time using shortest seek time first algorithm.
(a) 348ms
(b) 360ms
(c) 372ms
(d) 400ms

Q9. Consider the following table of arrival time, burst time and priority for
six processes P1, P2, P3, P4, P5, P6

The preemptive priority scheduling algorithm is used. The waiting time


for processes P1, P2 and P4 is respectively.
(a) 18, 13, 0
(b) 19, 13, 19
(c) 0, 3, 8
(d) 19, 13, 0
Q10. Consider the following processes with arrival times and processing
times.

Compute the average waiting time (in ms) of all processes using
remaining time first algorithm.
(a) 1
(b) 2
(c) 1.5
(d) 1.8

Q11. Consider a system with 21 instances of same resources type R and n


processes share them requesting 5 instances each. What would be the
maximum value of n such that system is in safe state?
(a) 3
(b) 4
(c) 5
(d) 6

Q12. A counting semaphore ‘C’ protecting a resource having a single


instance shared among n processes is initialized with value 1. If all
processes perform ‘P’ operation on semaphore ‘C’ before critical
section access and ‘V’ operation on semaphore ‘C’ after critical
section except one process which performs ‘V’ operation before
critical section and ‘P’ operation after critical section on ‘C’. What is
the maximum number of processes that can be in the critical section
simultaneously?
(a) n
(b) n-1
(c) n-2
(d) None of these

Q13.

Q14. Which of the following statement is NOT true in deadlock system?


(a) In deadlock detection scheme the allocation against resource availability
is checked for all possible allocation sequences to determine if the
system is safe or not.
(b) In deadlock avoidance scheme the request for resources is alwayss
granted if the resulting state is safe.
(c) In deadlock prevention scheme, knowledge of resources is required a
priori.
(d) None of these

Q15. Suppose a system has 32-bit virtual address and 4MB of physical
memory that is partitioned into 8192 byte pages. If the system uses
Inverted page table, how many page table entries should be there in
it?
(a) 256
(b) 512
(c) 1024
(d) 2048

Q16. A system has four processes and five allocatable resources. The current
allocation and maximum needs are as follows:

What is the smallest value of x for which this system is in a safe state?
(a) 1
(b) 2
(c) 3
(d) 4

Q17. If a process executes the following code, after the last statement, how
many processes exist (including the first one)?
int i;
for (i=0; i<3; ++i)
{
fork();
fork();
}
(a) 31
(b) 32
(c) 63
(d) 64
Q18. Consider a disk system with 50 cylinders. The requests to access the
cylinders occur in following sequence:
10, 22, 20, 40, 6 and 38
Assume that the head is currently at cylinder 20, what is the time
taken to satisfy all requests if takes 6ms to move from one cylinder
to adjacent one and FCFS policy is used?
(a) 580ms
(b) 620ms
(c) 660ms
(d) 710ms

Q19. Which of the following is False?


(a) Larger disk block results in greater internal fragmentation.
(b) Smaller page size results in less internal fragmentation.
(c) Fixed partitioning scheme results in external fragmentation.
(d) Variable partitioning scheme results in internal fragmentation.

Q20. What is the minimum number of page faults for an optimal page
replacement strategy for the reference string 1, 2, 3, 4, 5, 3, 4, 1, 6, 7,
8, 7, 4, 5, 3, 2, 1, 5, 4, 2 with 3 page frames? Consider the page frames
are empty initially.
(a) 13
(b) 14
(c) 15
(d) 16

Common questions

Powered by AI

The page size is 16 KB, equating to 2^14 bytes, thus requiring 18 bits to address within a page (since 1024 * 16 = 16384 = 2^14). The remaining 32 - 14 = 18 bits are used for the page number, requiring a total of 2^18 entries. Each entry must accommodate the page address and at least 2 protection bits. Assuming a minimal 4-byte entry for the address and protection bits, the page table size is 2^18 * 4 = 1 MB .

For the given problem on scheduling, with priority and specific arrival and burst times, the calculated waiting times are as follows: P1 = 19, P2 = 13, and P4 = 0. This is calculated by simulating the execution order of the processes, ensuring each process is served based on arrival time and priority .

Deadlock occurs due to circular waiting in semaphore operations, which can happen if the semaphore operations are not executed in a consistent manner. However, in this case, the semaphore m and n ensure that, while processes may wait, they won't be concurrently accessing the same shared resource, preventing a race condition. Correct semaphore handling avoids deadlock. No Deadlock and No race condition is ensured in this problem .

Applying SSTF to a disk with a head at cylinder 20 servicing requests in the sequence 10, 22, 20, 2, 40, 6, 38 minimizes travel between nearest requests: Head moves to 22 (2 cylinders), 20 (2), 10 (10), 6 (4), 2 (4), 38 (36), then 40 (2), total 60 cylinders moved, costing 348 ms .

A fork system call fails primarily when the system exhausts available process slots, which can happen if the user exceeds a predetermined limit of concurrent processes or system-wide process capacity is reached. Furthermore, a fork does not inherently fail based solely on previous execution contexts or syncing issues between parent and child processes unless limited by such capacity constraints .

When one process performs semaphore operations out of order compared to others, it can lead to disrupting the mutual exclusion maintained by the semaphore, potentially allowing one more process into the critical section than intended. However, the system described (n-1 maximum simultaneous entries) ensures that separation is maintained generally, except for the anomaly introduced .

An inverted page table involves one entry per actual page frame in physical memory. With 32-bit virtual addresses and 4MB of physical memory partitioned into 8192-byte pages, 4MB/8192 = 512 page frames are present, so there are 512 entries in the inverted page table .

In a system with 21 instances of a resource and processes requesting 5 instances each, the system can safely accommodate up to 4 processes. Calculating maximum processes is done by ensuring that upon a process finishing, enough resources are available to satisfy at least one waiting process (21 - (4-1)*5 = 6, sufficient for next allocation).

Each logical record is 140 bytes. A sector can hold 1024 bytes, which means it can accommodate \( \lfloor 1024 / 140 \rfloor = 7 \) records per sector. A track has 96 sectors, so a track can hold 96 * 7 = 672 records. A surface has 100 tracks, thus a surface can store 672 * 100 = 67,200 records. For 336,000 records, the number of surfaces required is \( \lceil 336,000 / 67,200 \rceil = 5 \) surfaces .

When applying the remaining time first scheduling algorithm to calculate average waiting time for processes, it is done by considering the shortest remaining time at each completion. Average calculating results in a balanced allocation over total processes and total waiting time resulting in an average waiting time of 1.5 ms .

You might also like