Operating Systems Test 1: Number of Questions: 35 Section Marks: 30
Operating Systems Test 1: Number of Questions: 35 Section Marks: 30
Operating Systems Test 1: Number of Questions: 35 Section Marks: 30
Directions for questions 1 to 35: Select the correct alterna- 9. Which of the following will be a reason for Process
tive from the given choices. Suspension?
1. Which of the following service is provided by an (A) Swapping
Operating System? (B) Interactive user request
(i) Access to I/O Devices (C) Parent process request
(ii) Controlled access to files (D) All the above
(iii) System Access 10. Which of the following is TRUE?
(iv) Accounting (A) The overhead involved in mode switch is more
(A) (i), (ii) (B) (iii), (iv) compared to process switch.
(C) (i), (ii), (iii) (D) (i), (ii), (iii), (iv) (B) The overhead involved in process switch is more
2. In which of the following modes, privileged instruc- compared to mode switch.
tions will be executed? (C) The overhead involved in process switch is same
(A) Kernel mode only as mode switch.
(B) User mode only (D) comparing the overhead involved in process
(C) Either kernel mode or user mode switch and mode switch is irrelevant.
(D) execution of privileged instruction is independent 11. Viruses, Logic bombs and Backdoors are examples of
of mode (A) Parasitic malware
3. In which of the following environment, the computer (B) Self-replicated malware
memory can hold three, four or more programs and a (C) Self-contained malware
single CPU switches among all of them for execution? (D) Active malware
(A) Uniprogramming (B) Multiprogramming 12. Which of the following details will be maintained by
(C) Multiprocessing (D) Both (B) and (C) each thread, in a multithreaded environment?
4. What is the principle objective of Time sharing system? (i) Register state (ii) Priority
(A) Maximize processor use (iii) Stack
(B) Minimize response time (A) (i), (ii) (B) (ii), (iii)
(C) Maximize memory usage (C) (i), (iii) (D) (i), (ii) and (iii)
(D) Minimize CPU idle time 13. Which of the following are advantages of using User-
5. Which of the following will not be included in the Level-Threads (ULT) over Kernel-Level-Threads?
Process Control Block of a process? (i) There is no need of kernel mode privileges for
(A) Process state (B) Program counter thread switching.
(C) Priority (D) None of the above (ii) ULTs can run on any OS.
(iii) A system call cannot block the entire process.
6. Which of the following best explains ‘process
(A) (i), (ii) (B) (i) only
spawning’?
(C) (ii), (iii) (D) (i), (iii)
(A) The OS creates a process at the explicit request of
another process. 14. Consider a multiprogramming environment, in which
(B) The OS creates a process to perform a function on two processes are running and one process is unaware
behalf of a user program. of another process, then which of the following prob-
(C) A process is created when a user logs on to the lems will occur?
system. (A) Mutual exclusion (B) Deadlock
(D) The OS creates a process as per its requirement. (C) Starvation (D) All the above.
7. For which of the following reason, a process will move 15. Which of the following will be (a) requirement(s) for
from ‘Running’ state to ‘Blocked’ state? mutual exclusion?
(A) Timeout (B) Dispatch (A) A process remains inside its critical section for a
(C) Suspend (D) Event wait finite time only.
(B) A process that halts in its non critical section must
8. If a process is in secondary memory and is available
do so without interfering with other processes.
for execution as soon as it is loaded into main memory,
(C) When no process is in a critical section, any pro-
then it is in __________ state.
cess that requests entry to its critical section may
(A) Ready (B) Blocked
be permitted to enter with some delay.
(C) Blocked/Suspend (D) Ready/Suspend
(D) Both (A) and (B)
3.168 | Operating Systems Test 1
16. Identify the correct sequence of actions from the fol- for k ():
lowing, to read data with a Virtual address using TLB }
and cache (Assume TLB and cache has miss): return 0;
(i) Access the TLB }
(ii) Read from cache Including the initial parent process, how many process-
(iii) Access memory to get address es will be created?
(iv) Access memory to read data. (A) 7 (B) 15
(A) (i), (ii), (iii), (iv) (B) (i), (iii), (ii), (iv) (C) 8 (D) 9
(C) (i), (ii), (iv), (iii) (D) (i), (iii), (iv), (ii) 23. Consider the following resource requests.
17. A 2-Level page translation scheme has 4 K byte pages P1 requests exclusive use of both R1 and R2
and 4 Byte page table entries. The virtual address has P2 requests exclusive use of both R2 and R3
32-bits. What is the number of bits required to access P3 requests exclusive use of both R3 and R4
first level; second level page table entries and offset in a P4 requests exclusive use of both R4 and R2
page respectively? Resources are assigned in process request order. (P1 is
(A) 9, 9, 14 (B) 12, 12, 8 first). Which of the following is TRUE?
(C) 10, 10, 12 (D) 8, 12, 12 (A) Given system is in deadlock.
18. What is the effective access time for TLB with 90% hit (B) There is a possibility of deadlock after P1 finishes
rate, 1 ns to access TLB and 10 ns to access memory. its execution.
(Assume a 2-level page table) (C) There is no deadlock in given system.
(A) 1 ns (B) 2 ns (D) After P1, if P2 executes then there is a possibility
(C) 3 ns (D) 4 ns of deadlock.
19. Consider the page reference string: 1, 2, 3, 4, 1, 2, 5, 24. Which of the following instructions can only be exe-
1, 2, 3, 4, 5. The number of page frames allocated is 3. cuted in kernel mode?
Using FIFO, in which way, the number of page faults (i) Load Instruction
change by increasing the page frames allocated to 4. (ii) Modify PC register
(A) increases by two (B) decreases by two (iii) Modify SP register
(C) increases by one (D) decreases by one (iv) Modify the register that controls kernel/user mode.
(v) Direct access to I/O device.
20. A 512 KB file is stored contiguously on one disk
(A) (i), (ii), (v) (B) (i), (iii), (iv)
track. Each track contains 1024 sectors, each sector is
(C) (iv), (v) (D) (ii), (iv)
512 bytes. Average seek time is 1 ms. And the rota-
tional speed is 15000 rpm. What is the average access Directions for questions 25 and 26: A computer with a
time to read the entire file? 32-bit address uses a 2-level page table. The virtual address
(A) 2 ms (B) 4 ms format is shown below:
(C) 7 ms (D) 3 ms 1st-level page table 2nd-level page table Off set
21. Consider mapping a Virtual memory of 1 GB onto a
physical memory organized into 256 page frames of 25. What is the page size?
4 KB each. Assume that the smallest addressable unit is (A) 1024 B (B) 2048 B
1 byte. Then which of the following is TRUE? (C) 4096 B (D) 8192 B
I. The page table fit in the main memory 26. How many pages are there?
II. The frame table fit in a single page. (A) 29 (B) 211
(A) I only (B) II only (C) 2 12
(D) 220
(C) Both I and II (D) Neither I nor II
27. Suppose that a 32-bit virtual address is broken up into
22. Consider below program segment: four fields p, q, r and s. The first three are used for a
# include < stdio.h> 3-level page table system. The fourth field, s is the off-
# include < unistd.h> set. Then which of the following is TRUE?
………………
(A) The number of pages depend on the total number
int main ()
of bits in p, q, r combined.
{
(B) The number of pages depend on the total number
pid p;
of bits in p, q, r and s combined.
p = fork ();
if (p = = 0) (C) The number of pages depend on the split among
{ the fields p, q, r.
fork (); (D) The number of pages depend on the split among
fork (); the fields p, q, r and s.
Operating Systems Test 1 | 3.169
28. A computer provides each process with 65, 536 bytes 32. Consider below features:
of address space. A particular program has a text size (i) This scheduler has more speed.
of 32768 bytes, a data size of 16386 bytes and a stack (ii) The scheduler has less control over the degree of
size of 15870 bytes. If a page may not contain parts of multiprogramming.
two different segments then which of the following is (iii) The scheduler is minimal in time sharing systems.
TRUE? Which scheduler has above features?
(A) The program will fit in the address space if the (A) Long-term scheduler
page size is 4096 bytes.
(B) Medium-term scheduler
(B) The program will fit in the address space if the
(C) Short-term scheduler
page size is 2048 bytes.
(C) The program will fit in the address space if the (D) None of these
page size is 1024 bytes. 33. Consider a system consisting of four processes and
(D) The program will fit in the address space if the single resource. The current status of the Claim and
page size is 512 bytes. Allocation matrices are:
29. The Newton–Raphson method is applied to compute a
root of the equation f(x) = x4 – x3 – x2 – 21x + 18 = 0. 4 2
3 2
With x0 = 3.1 as the initial solution, the method con- C= A=
verges to an exact solution after how many iterations? 10 4
(A) 1 (B) 4 7 2
(C) 7 (D) 10
30. How many disk operations are needed to fetch the What is the minimum number of units of the resource(s)
inode for the file Admin/OS/UNIX/File/src.p? needed to be available for this state to be safe?
Assume that the inode for this root directory is memory (A) 0 (B) 1
but nothing else along the path is in memory. (Note: All (C) 2 (D) 3
directories fit in one disk block) Common Data Questions 34 and 35:
(A) 5 (B) 10 Consider two CPU scheduling algorithms for a single CPU:
(C) 4 (D) 8 Round Robin scheduling and Shortest job First scheduling.
Consider below five processes with arrival times and ex-
31. The beginning of a free space bitmap looks like below
pected CPU time.
after the disk partition is first formatted:
1000 0000 0000 0000 ……… Process Arrival time Expected
The system always searches for free blocks starting CPU Time
at the lowest numbered block. So after writing file A, P1 0 15
which uses 5 blocks, the bit map looks like: 1111 1100 P2 3 13
0000 0000 Then what will be the bit map after perform- P3 5 9
ing following P4 6 5
actions:
P5 18 8
(i) File B of 6 blocks is written
(ii) File A is deleted 34. What is the average waiting time using SJF?
(iii) File C of 7 blocks is written (A) 5 (B) 10
(iv) File B is deleted (C) 13.6 (D) 15.4
(A) 1111 1111 0000 0000 …….. 35. What is the average waiting time using Round Robin
(B) 1111 1111 1111 1100 …… scheduling with time quantum of 6 units?
(C) 1111 1100 0000 1100 …… (A) 36.2 (B) 18.4
(D) 1000 0000 0111 1111 ……… (C) 12.6 (D) 23.4
Answer Keys
1. D 2. A 3. B 4. B 5. D 6. A 7. D 8. D 9. D 10. B
11. A 12. D 13. A 14. D 15. D 16. B 17. C 18. C 19. C 20. C
21. C 22. D 23. B 24. C 25. C 26. D 27. A 28. D 29. B 30. B
31. C 32. C 33. B 34. C 35. D
3.170 | Operating Systems Test 1
1. All those services are provided by OS. Choice (D) So the sequence of actions will be (i), (iii), (ii), (iv)
2. Privileged instructions will be executed in kernel mode, Choice (B)
in which protected areas of memory will be accessed. 17. Page size = 4 KB = 212 B.
Choice (A) ⇒ 12-bits required to identify a byte in a page.
3. In Uniprogramming, the memory holds only a single
program. In multiprogram, the CPU executes more 1st Level 2nd Level Offset
than one program in time interleaved fashion, which
are present in memory. In multiprocessing, There will 32-bits
be more than one CPU executing more than one pro-
gram. Choice (B) 212
Number of entries in 2nd level Page table = = 210
4. The Time sharing system handles multiple interactive 4
jobs, so that response time will be reduced. Choice (B) ∴ 10 bits required for 2nd level. Similarly for first
5. PCB holds information about a process. Choice (D) level also 10-bits required. Choice (C)
7. A process will be in blocked state if it is waiting for an 18. Effective TLB access time
event to occur. Choice (D) = hit ratio * TLB access time + (1-hit ratio) * (TLB
access time + memory access time *2)
10. Mode switch occurs without changing the state of = 0.9 * 1 + (0.1) * (1 + 20) = 0.9 + 2.1 = 3 ns.
process. Process switch requires some changes in its Choice (C)
environment.
∴ Overhead of process switch is greater than mode 19. Initially, page frames allocated = 3
switch. Choice (B) 1 2 3 4 1
11. In Parasitic malware, the fragments of programs do not 1 1 1 4 4
exist independently Choice (A) 2 2 2 1
12. In multithreaded environment, each thread maintains a 3 3 3
stack, register values, priority and other thread related F F F F F
state information. Choice (D)
13. In ULTs, the thread management will be done by thread 2 5 1 2 3
library. So no need of kenel mode privileges for thread 1 5 5 5 5
switching. On any OS, ULTs can run. A system call 2 5 1 1 1
blocks entire process. Choice (A) 3 3 3 2 2
14. If processes are unaware of each other then competition 3 4 4 4 3
exist between them. There is a possibility of Mutual F F F F
exclusion, Deadlock and Starvation. Choice (D)
15. There will be no delay in permitting a process to enter 4 5
its critical section if no process is in critical section. 4 4
Choice (D) 4 5
16. 2 2
Virtual Address 3 3
F F
memory
miss
∴ Number of page faults = 9
TLB page Page frames Allocated = 4
table
Hit 1 2 3 4 1
Read
1 1 1 1 1
Data
miss 2 2 2 2
cache
3 3 3
Hit 4 4
Read data F F F F
Operating Systems Test 1 | 3.171
4 5
4 4
P3 P4
1 5
2 2
3 3
Initially P1 completes and releases its resources. Now if
F F
P4 acquires R2, then P2 waits for R2, P4 waits for R4, P3
∴ Number of page faults = 10 waits for R3. There is a circular wait. But if P2 acquires
∴ Number of page fault increases by one. Choice (C) R2 then there will be no deadlock. Choice (B)
20. Seek time = 1 ms 24. Load, modify PC, SP are not protected instructions.
Rotational speed = 15000 RPM. Modifying the register that controls kernel/user mode
15000 RPM = 15000/60 RPS = 250 rps is a protected instruction. Otherwise any process can
1 make itself run in kernel mode. I/O devices are only
Rotational delay = = 2 ms
2 × 250 directly accessible by the OS. Choice (C)
512 × 1024 25. Offset = 12 bits
Transfer time = = 4 ms
250 × 1024 × 512 Using 12-bits, we can access 212 bytes. So the page size
∴ Total time = seek time + Rotational delay + Trans- is 212 = 4096 bytes. Choice (C)
fer time = 7 ms Choice (C)
Virtual memory
21. Virtual memory = 1 GB = 2 B 30 26. Number of pages =
Page size
Page frames = 256
Page size = 4 KB 232
Number of pages = = 220 Choice (D)
Physical memory = 256 * 4 K = 220 B. 212
230 18
Number of pages = 12 = 2 27. The number of pages depend on p + q + r. Choice (A)
2 28. Given total address space = 65536 bytes
Page table size will fit in main memory. (main memory
Text size = 32768 bytes
= 220 B, Page table size = 218 * PTE,
Data size = 16386 bytes
PTE will be less than 4 B)
Stack size = 15870 bytes
∴ I is true
If page size = 4096
Frame table size = 256 * (8 + 18) = 6656 bits
65536
This can fit in a page. Total pages in memory = = 16
∴ It is true. Choice (C) 4096
22. Fork () is used to create a child process A parent process 32768
Pages for text = =8
returns the id of its children. A child process returns 4096
zero The first fork () call creates a child process. Only 16386
for child process p = 0, so child process only executes Pages for data = =5
4096
3 fork() call statements, which creates 7 child processes. 15870
∴ Total processes = 7 + 1 + 1 = 9 Pages for stack = =4
4096
parent
Total pages required for process = 8 + 5 + 4 = 17
Child 1 (p = 0) fork ( ); ∴ Choice (A) is wrong.
Similarly if page size is 2048, the memory consists
fork ( ); of 32 pages. If page size is 1024, the memory con-
Child 2
sists of 64 pages, but process requires 65 pages.
If page size = 512 bytes,
Child 3 fork ( );
Child 4 Memory consists of 128 pages and process re-
quires 128 pages.
fork ( );
Child 5 Child 6 Child 7 Child 8 Choice (D) ∴ Choice (D) is correct Choice (D)
3.172 | Operating Systems Test 1
29. The iterative formula for finding root of f(x) = 0 in Total resources (R) = 10, Available (V) = 0
Newton–Raphson method is Need 1 more additional resource for execution of P2.
xk+1 = xk −
f ( xk ) ⇒ R = 11, V = 1
f ′( xk ) Now p2 can complete. And it releases its allocted
resources.
By using this formula, starting with k = 0 and x0 = 3.1,
⇒ R = 11, V = 3
it can be easily observed that x4 = 3 (the exact root)
p1 requires 2 more resources. After execution it
∴ After 4 iterations, the method converges to exact releases those 2 + allocated resources i.e., 4
root. Choice (B)
⇒ R = 11, V = 5
30. As all directories fit in one disk block, then all required Now p4 can execute with the available and allo-
data on a directory is stored in the inode itself. cated resources.
To open /Admin/OS/UNIX/file/src.p ⇒ R = 11, V = 7
We do following reads: Now p3 can execute.
1. inode of /→ Already in memory ∴ One additional resource required.
2. Directory for / Choice (B)
3. inode of /Admin
4. Directory of /Admin 34. Shortest-job-First algorithm will select the shortest
CPU burst time first.
5. inode of /Admin/OS
6. Directory of /Admin/OS P1 P4 P5 P3 P2
7. inode of /Admin/OS/UNIX 0 15 20 28 37 50
8. Directory of /Admin/ OS/UNIX/File Waiting time of P1 = 0
9. inode of /Admin/OS/UNIX/File Waiting time of P2 = 37 – 3 = 34
10. Directory of /Admin/ OS/UNIX/File Waiting time of P3 = 28 – 5 = 23
11. inode of /Admin/OS/UNIX/file /scr.p Waiting time of P4 = 15 – 6 = 9
∴ 10-disk read operations required. Choice (B) Waiting time of P5 = 20 – 18 = 2
31. Bitmap after writing A is (0 + 34 + 23 + 9 + 2)
∴ Average waiting time =
1111 1100 0000 0000 ….. 5
1111 11 11 1111 0000 ..... = 13.6 units
File B (6 Blocks):
A B Choice (C)
Delete A : 1000 0011 1111 0000 …… 35. In Round Robin algorithm with time quantum 6 units,
1111 11 11 1111 1100 ..... each job executed for 6 units and wait in waiting queue.
File C (7 blocks): The job with more waiting time will be executed first.
C B C
P1 P2 P3 P4 P1
1 111 11 000000 110 .....
Delete B: 0 6 12 18 23 29
C C
∴ Final bitmap : 1111 1100 0000 1100 ... Choice (C) P2 P5 P3 P1 P5
35 41 44 47 49
32. A short-term scheduler selects the process which is
ready to execute. It does not have that much of control Waiting time of P2 = (6 – 3 ) + (29 – 12) = 20
over degree of multiprogramming Choice (C) Waiting time of P3 = (12 – 5 ) + (41 – 18) = 30
Waiting time of P4 = (18 – 6) = 12
33.
Waiting time of P5 = ( 35 – 18) + (47 – 41) = 23
p1 2
32 + 20 + 30 + 12 + 23
p2 2 Average waiting time = = 23.4
Allocation = 5
p3 4
p4 2 Choice (D)