0% found this document useful (0 votes)
236 views5 pages

Operating Systems Test 2: Number of Questions: 35 Section Marks: 30

1. The document is a 35 question test on operating systems. It covers topics like memory management, scheduling algorithms, deadlocks, and threads. 2. Maximum fragmentation is 10 bytes and minimum is 0 bytes. Scheduling favors CPU-bound programs. Mutual exclusion, hold and wait, circular wait are necessary for deadlocks. 3. After an I/O instruction, a process is in the blocked state. System calls are used to request services from the kernel. Threads within a process allow for high performance with both I/O and CPU activity.

Uploaded by

AKASH PAL
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)
236 views5 pages

Operating Systems Test 2: Number of Questions: 35 Section Marks: 30

1. The document is a 35 question test on operating systems. It covers topics like memory management, scheduling algorithms, deadlocks, and threads. 2. Maximum fragmentation is 10 bytes and minimum is 0 bytes. Scheduling favors CPU-bound programs. Mutual exclusion, hold and wait, circular wait are necessary for deadlocks. 3. After an I/O instruction, a process is in the blocked state. System calls are used to request services from the kernel. Threads within a process allow for high performance with both I/O and CPU activity.

Uploaded by

AKASH PAL
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
You are on page 1/ 5

Operating Systems Test 2

Number of Questions: 35 Section Marks: 30

Directions for questions 1 to 35: Select the correct alterna- (C) All the threads cannot share open files, child pro-
tive from the given choices cesses.
1. Suppose we have variable logical records of length (D) Each thread will maintain Accounting Informa-
10 bytes, 20 bytes and 30 bytes, while the physical tion.
block size in disk is 15 bytes. What is the maximum 9. Which of the following is FALSE with respect to a
and minimum fragmentation seen in bytes? monitor?
(A) 10 and 5 (B) 10 and 0 (A) Only one process can be active in a monitor at any
(C) 5 and 0 (D) 5 and 5 instant.
2. Match the following: (B) A monitor is a collection of procedures.
(C) Procedures declared outside the monitor can ac-
List-A List-B
cess monitor’s internal data structure.
1. Contiguous allocation policy (i) Internal fragmentation (D) Monitors can be used to provide mutual exclusion.
2. Chained list allocation (ii) External Fragmentation
10. Which of the following is a reason for process
3. Indexed allocation scheduling?
(i) When a new process is created.
(A) 1–(i), 2–(i), 3–(i) (B) 1–(i), 2–(i), 3–(ii) (ii) When a process exits.
(C) 1–(ii), 2–(i), 3–(i) (D) 1–(ii), 2–(ii), 3–(i) (iii) When a process blocks.
3. Suppose that the scheduling algorithm favors those (iv) When an interrupt occurs.
processes that have used the least processor time in the (A) (i), (ii) (B) (i), (iii), (iv)
recent past. Then which of the following is TRUE? (C) (ii), (iii) (D) (i), (ii), (iii), (iv)
(A) The algorithm favors I/O bound programs. 11. Match the following:
(B) The algorithm favors CPU bound programs.
(C) Fair treatment to all the programs. List-A List-B
(D) The algorithm favors longer programs. 1. First Come First Serve I. High throughput
4. Which of the following is not a necessary condition for 2. Shortest Process Next II. Fair treatment of processes
deadlock? 3. Round Robin III. Non-preemptive
(A) Mutual exclusion (B) Hold and wait
(C) Circular wait (D) Reentrancy (A) 1-II, 2-III, 3-II (B) 1-III, 2-I, 3-II
5. What will be the state of a process after it encounters an (C) 1-I, 2-III, 3-II (D) 1-I, 2-II, 3-III
I/O instruction? 12. To use process switching in hardware, instead of inter-
(A) Ready (B) Blocked rupts, the CPU needs to know about
(C) Idle (D) Running (A) Process table data structure
6. Which of the following is used by a program to request (B) System calls
a service from an operating system’s kernel that it does (C) CPU burst time
not normally have permission to run? (D) PC only
(A) Context switch (B) Threads 13. Which of the following is FALSE?
(C) System call (D) Service call (A) Throughput is the number of processes that com-
7. Which of the following is the reason for having threads plete their execution per unit time.
within a process? (B) Turnaround time is the amount of time required to
(i) Threads are lighter in weight than processes. execute a particular process.
(ii) Threads have high performance when the process- (C) Waiting time is the amount of time, a process has
es have both I/O and CPU activity. been waiting in the ready queue.
(iii) Threads are useful on systems with multiple (D) Response time is the amount of time taken to get
CPU’s. the output.
(A) (i), (ii) (B) (ii), (iii) 14. Which of the following scheduling algorithm is also
(C) (i), (iii) (D) (i), (ii), (iii) referred as preemptive version of FCFS?
8. Which of the following is TRUE? (A) Shortest Job First
(A) No protection required between threads. (B) Round Robin
(B) Different threads in a process are always inde- (C) Shortest Remaining Time First
pendent. (D) None of these
3.174 | Operating Systems Test 2

15. Which of the following malware can result in pop-up allocation in this system?
ads or can redirect a browser to a commercial site? (A) 1 KB (B) 2 KB
(A) Spyware (B) Adware (C) 4 KB (D) 8 KB
(C) Zombie (D) Backdoor 23. On a system with 264 bytes of memory and fixed parti-
16. In 48-bit machine, with 4 GB RAM and 8 KB page tions with a partition size of 220 bytes, what is the mini-
size, how many entries will be there in the page table if mum number of bits needed in an entry in the process
it is inverted? table to record the partition to which a process has been
(A) 235 (B) 220 allocated?
19
(C) 2 (D) 213 (A) 20-bits (B) 32-bits
17. Consider the following process and resource require- (C) 36-bits (D) 44-bits
ment of each process. 24. Which of the following features are required by an
ideal CPU scheduling algorithm?
Resource 1 Resource 2
Process (i) Maximize the CPU utilization
Used Max Used Max
(ii) Maximize the throughput
P1 2 3 2 4 (iii) Minimize the turnaround time
P2 2 4 2 3 (iv) Minimize the waiting time
P3 3 5 2 5 (v) Minimize the response time
(A) (i), (iii), (v) (B) (ii), (iv), (v)
Assume that there are a total of 8 instances of resource (C) (i), (ii), (iv), (v) (D) (i), (ii), (iii), (iv), (v)
type 1 and 7 instances of resource type 2. What is the 25. Consider the following set of processes:
state of this system?
(A) Can go to safe or unsafe state based on sequence. Process Burst time Priority
(B) Safe state P1 10 3
(C) Unsafe state P2 1 1
(D) Deadlock state P3 2 3

18. Consider a system that has two CPU’s and each CPU P4 1 4
has two threads. Suppose three programs P1, P2 and P5 5 2
P3 are started with run times 10, 15 and 25 ms respec- The processes are assumed to have arrived in the order
tively. What is the minimum time required to complete P1, P2, P3, P4 and P5 all at time 0. What is the average
the execution of these programs? Turnaround time using Shortest Job First scheduling?
(A) 25 ms (B) 35 ms (A) 5 (B) 7
(C) 45 ms (D) 40 ms (C) 15 (D) 19
19. A computer system has enough room to hold five pro- 26. Consider the given concurrent processes:
grams in its main memory. These programs are blocked Process P0:
on I/O, half the time. What fraction of the CPU time is while (true)
wasted? {
(A) 96.8% (B) 32% while(turn = = 1);
(C) 3.125% (D) 50% critical section
20. A computer has 4 GB of RAM, of which the operat- turn = 1
ing system occupies 256 MB. The processes are all remainder section
128 MB and have the same characteristics. If the goal }
is 95% CPU utilization, what is the maximum I/O wait Process P1:
that can be tolerated? while (true)
(A) 90.4% (B) 85.4% {
(C) 72% (D) 50% while (turn = = 0);
critical section
21. A file system with 4 KB blocks can access 64 GB worth
turn = 0
of data through an i-node triple indirect block.
remainder section
How many bits does the file system use for block
}
pointers?
‘turn’ is a global Boolean variable, Which will take
(A) 8 (B) 16
either 0 or 1. Which of the following is TRUE for above
(C) 32 (D) 64
two processes?
22. In a File Allocation table, each entry is of size 24-bits. (A) There is mutual exclusion and progress.
For a 32 GB disk, what is the minimum size of a file (B) There is progress but no mutual exclusion
Operating Systems Test 2 | 3.175

(C) There is mutual exclusion but no progress. (iii) Reset page table
(D) There is no mutual exclusion and no progress. (iv) Bring in missing page
27. Consider ‘n’ concurrent processes P1, P2, ... Pn whose (v) Restart instruction
code is shown below: (vi) The OS takes control on trap.
var mutex : semaphore (A) (i), (ii), (iv), (v), (vi), (iii)
mutex = 1; (B) (ii), (i), (v), (iv), (iii), (vi)
process Pi: (C) (i), (vi), (ii), (iv), (v), (iii)
Repeat (D) (i), (vi), (ii), (iv), (iii), (v)
wait (mutex); 31. If the multiprogramming level increases rapidly then
critical section the processor utilization:
signal (mutex); (A) always increases (B) always decreases
Remainder section (C) decreases some times (D) doesn’t effected
until false; Common Data for Questions 32 and 33
Then which of the following is TRUE? Consider a swapping system in which memory consists
(A) There is mutual exclusion. of the following hole sizes in order:11 KB, 5 KB, 21 KB,
(B) There is no mutual exclusion in the system. 19 KB, 8 KB, 10 KB, 13 KB and 16 KB.
(C) There is a deadlock in the system 32. Which hole is taken for successive segment requests
(D) Both (B) and (C) 13 KB, 11 KB and 10 KB for First-fit?
28. Which of the following correctly specifies the ‘wait’ (A) 13 KB, 11 KB, 10 KB (B) 21 KB,11 KB,19 KB
operation of a counting semaphore? (C) 11 KB, 5 KB, 21 KB (D) 13 KB, 16 KB, 11 KB
(A) semvalue = semvalue – 1; 33. Which hole is taken for successive segment requests
if semvalue < 0 then 12 KB, 10 KB, 9 KB for Best-fit?
Add this process to Blocked queue. (A) 21 KB, 19 KB, 11 KB (B) 13 KB, 16 KB, 11 KB
(B) semvalue = semvalue + 1 ; (C) 13 KB, 10 KB, 11 KB (D) 13 KB, 11 KB, 10 KB
if semvalue ≤ 0 then
Common Data for Questions 34 and 35
Block the process;
A computer has four page frames. The time of loading, time
(C) semvalue = semvalue – 1;
of last access and modify (M) bits of each page are shown
if semvalue ≤ 0 then
as below.
Block the process;
(D) semvalue = semvalue – 1; Page Load Time Last access time M
if semvalue < 1 then Block the process 0 149 198 1
29. Identify the TRUE statements from the following: 1 255 280 0
(i) Logical address is generated by the CPU. 2 85 293 0
(ii) Physical address is the address seen by the memo- 3 129 285 1
ry unit.
(iii) The user program always deals with physical ad- 34. Which page will FIFO algorithm replace next?
dress. (A) page 0 (B) page 1
(A) (i), (ii) (B) (i), (iii) (C) page 2 (D) page 3
(C) (ii), (iii) (D) (i), (ii), (iii) 35. Which page will LRU algorithm replace next?
30. The correct sequence of steps required for page fault (A) page 0 (B) page 1
handling from the following is: (C) page 2 (D) page 3
(i) Search in the page table.
(ii) Search for the page in the backing store.

Answer Keys
1. B 2. C 3. A 4. D 5. B 6. C 7. D 8. A 9. C 10. D
11. B 12. A 13. D 14. B 15. B 16. C 17. D 18. A 19. C 20. A
21. A 22. B 23. D 24. D 25. B 26. C 27. A 28. A 29. A 30. D
31. C 32. B 33. C 34. C 35. A
3.176 | Operating Systems Test 2

Hints and Explanations


1. Record lengths are 10, 20, 30 Bytes 15. Advertising that is integrated into software is adware.
Physical block size = 15 bytes. Choice (B)
Maximum fragmentation occurs with 20 byte records. 16. In inverted page table, the number of entries is the
5B number of frames in the main memory.
Main memory capacity = 4 GB = 232B
15 bytes 15 bytes Page size = frame size = 8 KB = 213B
232 19
∴ Maximum fragmentation = 10 bytes ∴ Number of entries = 13 = 2 Choice (C)
2
Minimum fragmentation occurs with 30 byte
records.  R1   8 
17. Total resources (R) =   =  
 R2   7 
7
15 bytes 15 bytes Total used resources =  
6 
∴ Minimum fragmentation = 0 Bytes. Choice (B)
1
2. In Contiguous file Allocation, each file occupies a set Available resources(V) =  
of contiguous blocks on the disk. It suffers from exter- 1
nal fragmentation. In linked and indexed allocation, P1 requires (1, 2) resources.
there is internal fragmentation. Choice (C) P2 requires (2, 1) resources.
3. The algorithm favors I/O bound programs because of P3 requires (2, 3) resources.
the relatively short CPU burst request by them. No process can execute with available resources.
Choice (A) So the system is in deadlock. Choice (D)
4. The necessary and sufficient conditions for deadlock 18. On one CPU, at a time only one program will be exe-
are Mutual exclusion, Hold-and-wait, No-preemption cuted. At a time two programs will be in running state.
and Circular wait. Choice (D) If P1, P2 are executed on CPU1 and P3 executed on
another CPU, the execution time will be 25 ms.
5. During I/O instruction execution, a process will be in
Choice (A)
‘Blocked’ state. Choice (B)
19. CPU utilization = 1 – pn
6. A system call is used to get services of OS’s kernel.
where n is the degree of multiprogramming and ‘p’ is
Choice (C)
the fraction of time a process spends waiting for I/O.
8. No protection is required between threads. (As it is Here n = 5
impossible and not necessary). Threads are dependent 1
on each other. Threads can share open files and child p =
2
processes. Accounting information is maintained by 5
1 1
process. Choice (A) ∴ CPU time wasted =   = 0.03125 = 3.125%
2 32
9. Procedures declared outside the monitor can’t access
Choice (C)
monitor’s internal data. Choice (C)
20. RAM capacity = 4 GB = 232 B
10. All the four are reasons for process scheduling. OS capacity = 256 MB = 228B
Choice (D) Remaining = 232 – 228 = 4026531840
11. FCFS, SPN both are non-preemptive. FCFS’s through- Process capacity = 128 MB = 227B
put is not that much emphasized. It also penalizes short ∴ Number of processes fit in remaining space
processes. SPN penalizes long processes. Its through- 4026531840
put is high. Round Robin is preemptive and it treats all = = 30
227
processes fairly. Choice (B) 30 processes can be placed in memory at a time.
12. To use process switching, the CPU needs to know about Let ‘P’ is the probability that a process has an I/O.
process table and state. Choice (A) If all the 30 processes are in I/O, the probability is
13. Response time is the amount of time it takes from, P30.
when a request was submitted until the first response is CPU idle percentage = 5%
produced. Choice (D) By equating both,
14. Round Robin is the preemptive version of FCFS. P30 = 0.05 ⇒ P = 0.904
Choice (B) So we can tolerate processes with upto 90.4% I/O.
Choice (A)
Operating Systems Test 2 | 3.177

21. Data accessed using inode triple indirect block = 64 GB 30. Page fault occurs when the page for which CPU is
Block size = 4 KB searching is not in memory. Initially we search in the
(Number of blocks)3 × block size page table. If it is a trap, the OS takes the control. OS
= Data accessed using triple indirect blocks searches the backing store for the required page and
(Number of blocks)3 × 4 K = 64 G places it in memory. Updates the page table and restarts
236 the instruction. Choice (D)
⇒ (Number of blocks)3 = 12
2 31. If the multiprogramming level increases from a small
⇒ Number of blocks = 28 value, then the processor utilization rises.
∴ Bits required for block pointer = 8-bits But from a point onwards, the number of page faults
Choice (A) rises dramatically and processor utilization collapses.
22. Disk capacity = 32 GB = 235B The graph is shown below.
Each entry size = 24-bits

Processor utilization
Using 24-bits, we can access 224 B.
∴ Minimum size of a file allocation
235
= 24 = 211 B = 2 KB Choice (B)
2
23. Memory = 264B
Partition size = 220B Multiprogramming level Choice (C)
264 44
Number of partitions = 20 = 2 Common Data for Questions 32 and 33
2
32. Memory system with given hole sizes is shown below:
∴ 44-bits required for an entry in the process table.
Choice (D) 11KB
24. All those features are required by an ideal algorithm.
5KB
Choice (D)
25. In SJF the job with smallest CPU burst will execute 21KB
first. The Gantt chart for given processes is shown
19KB
below:
P2 P4 P3 P5 P1 8KB
0 1 2 4 9 19
10KB
Turn Around Time (TAT) of P1 = 19 (waiting time
+ CPU burst) 13KB
TAT of P2 = 1
TAT of P3 = 4 16KB
TAT of P4 = 2
TAT of P5 = 9 In first-fit policy, choose the hole from beginning of the
19 + 1 + 4 + 2 + 9 35 memory, using which given request is satisfied.
Average TAT = = = 7 units 13 KB placed in 21 KB.
5 5
11 KB placed in 11 KB.
Choice (B)
10 KB placed in 19 KB. Choice (B)
26. Initially ‘turn = 0’ then P0 only can enter the critical
33. Best-fit policy searches for all holes in the memory
section and if P1 tries to enter, it is not possible to enter
and selects the smallest hole using which the memory
critical section.
request will be satisfied.
Only one process can enter critical section. So there is
12 KB placed in 13 KB
mutual exclusion. But there is no progress. ( A pro-
10 KB placed in 10 KB
cess cannot be able to enter into critical section even if
9 KB placed in 11 KB Choice (C)
no process is in critical section). Choice (C)
34. FIFO will replace the page which entered first into the
27. Only one process can enter the critical section at a time.
memory.
So there is mutual exclusion. Choice (A)
Load time of page 2 is least
28. The wait operation decrements the semaphore value. If ∴ FIFO replaces page 2. Choice (C)
it is less than zero, block the process. Choice (A)
35. LRU replaces the page whose access time is least.
29. User program deals with logical address. Access time of page 0 is least. So LRU replaces page 0.
Choice (A) Choice (A)

You might also like