Assignments
Assignments
Assignment 1
Q1. Which of the following is not the responsibility of the operating system?
(A) Resource management
(B) Control the program execution
(C) Creation of a user-friendly environment
(D) Network management
(E) Compiler design
Ans: (E) Compiler design
Q8. Which of the following is incorrect for an interactive Operating System (OS)?
(A) It is designed for batch processing
(B) It is designed to achieve a response time as low as possible
(C) It is designed to respond promptly to user inputs
(D) It is suitable for multi-programming environment
(E) It is suitable for multi-user system
Ans: (A) It is designed for batch processing
Assignment 2
Q1. What is the best activity performed by the operating system for process management?
(A) Allocation of memory to different processes.
(B) Management of input and output operations.
(C) Scheduling of processes to improve the system throughput.
(D) Handling of system errors.
(E) Handling of system interrupts.
Ans: (C) Scheduling of processes to improve the system throughput.
Q6. Which system call creates a shared memory segment in Unix-like operating systems?
(A) shmdt()
(B) shmget()
(C) pipe()
(D) shmctl()
(E) shmsnd()
Ans: (B) shmget()
Q7. Which of the following is not a feature of the MS-DOS operating system?
(A) Command-Line Interface (CLI).
(B) Single-tasking.
(C) File Allocation Table (FAT) file system.
(D) Multi-tasking.
(E) Device Drivers
Ans: (D) Multi-tasking.
Q8. Which of the following is not a core feature of the UNIX-like operating system?
(A) Multi-user.
(B) Mult-programming.
(C) Process management.
(D) Error handling.
(E) Batch Processing.
Ans: (E) Batch Processing.
Q2. Which of the following operating systems is not based on microkernel system structure?
(A) Mach
(B) MINIX
(C) HURD
(D) QNX
(E) UNIX
Answer: (E) UNIX
Q5. Which of the following system calls is used to create a new process in Unix-like operating
systems?
(A) fork()
(B) exec()
(C) create()
(D) spawn()
(E) process()
Answer: (A) fork()
Q7. Which of the following is not included in the process control block?
(A) Process state and priority
(B) File descriptors and environment variables
(C) Program counter and stack pointer
(D) Memory management information
(E) Process termination time
Answer: (E) Process termination time
Q9. Which of the following is an invalid reason that a process enters the waiting state?
(A) The process requests input or output operations.
(B) The process requires a resource that is currently unavailable.
(C) The process is waiting for an event or signal from another process.
(D) The parent process is waiting for one or more of its child processes to complete execution.
(E) The process requests some memory, and the request is granted.
Answer: (E) The process requests some memory, and the request is granted.
Q10. Which of the following is the primary function of the long-term scheduler?
(A) Allocating CPU to processes
(B) Manage the degree of multiprogramming
(C) Managing process states
(D) Handling process synchronization
(E) Implementing process scheduling policies
Answer: (B) Manage the degree of multiprogramming
Assignment 4
Q1. What is the purpose of a context switch in an operating system?
(A) Allocate memory to a new process
(B) Deallocate the memory from a process
(C) Save and restore the state of a process to allow multitasking
(D) Terminate a process
(E) Initialize a new process in the ready queue
Answer: (C) Save and restore the state of a process to allow multitasking
Q2. Which of the following system call is used to replace the current process image with a new process
image.
(A) fork()
(B) execl()
(C) exit()
(D) wait()
(E) sleep()
Answer: (B) execl()
(C) log n
2
(D) nlog n 2
(E) √n
Answer: (A) n
Q10. Which of the following system calls is not related to the shared memory interprocess communication?
(A) shmget()
(B) shmat()
(C) shmdt()
(D) shmctl()
(E) shmext()
Answer: (E) shmext()
Assignment 5
Q1. Assume we are running an application on a system with four processing cores. This
application has both serial (nonparallel) and parallel components. Also, assume that 60% of
this application are executed in parallel and 40% of the application is executed in serial. Based
on the Amdahl’s Law, this application gets a speedup (approx.) of
(A) 1.30 times
(B) 1.42 times
(C) 1.25 time
(D) 1.81 times
(E) 1.20 times
Answer: (D) 1.81 times
Q3. Which is of the following multithreading model is unsuitable for multicore systems?
(A) Many-to-one
(B) One-to-one
(C) Many-to-Many
(D) One-to-Many
(E) Many-to-Partial
Answer: (A) Many-to-one
Q4. Which of the multithreading model blocks the entire process if a thread, which is a part
of the process, makes a blocking system call?
(A) Many-to-Many
(B) Many-to-one
(C) Many-to-Partial
(D) One-to-Many
(E) One-to-one
Answer: (B) Many-to-one
Q5. Which of the following operating systems does not support the Many-to-Many
multithreading model?
(A) Solaris
(B) HP-UX
(C) Tru64 UNIX
(D) IRIX
(E) Windows 11
Answer: (E) Windows 11
Q6. Which system calls allow the calling thread to wait for another thread to terminate?
(A) pthread_create
(B) pthread_exit
(C) pthread_join
(D) pthread_detach
(E) pthread_wait
Answer: (C) pthread_join
Q7. Which of the following statements about non-preemptive scheduling is NOT true?
(A) Once a process starts executing, it runs to completion before another process can begin.
(B) It is simpler to implement compared to preemptive scheduling.
(C) It can lead to longer waiting times for processes with short burst times.
(D) It allows the operating system to preempt a running process to give CPU time to a
higher-priority process.
(E) It is commonly used in batch-processing systems.
Answer: (D) It allows the operating system to preempt a running process to give CPU time to
a higher-priority process.
Q10. Which of the following is not a criterion used to evaluate CPU scheduling algorithms?
(A) Throughput
(B) Response time
(C) Memory usage
(D) Turnaround time
(E) Waiting time
Answer: (C) Memory usage
Assignment 6
Q1. Assume that the following processes are scheduled using the Shortest-Job-First process
scheduling policy. Determine the average waiting time.
Process Arrival time Burst time
P 1 1 3
P 2 0 2
P 3 3 2
P 4 2 4
(A) 3.5
(B) 2.5
(C) 1.5
(D) 4.5
(E) 0.5
Ans: (C) 1.5
Explanation: P2 (0—2), P1( 2 – 5), P3 (5 – 7), P4 (7 – 11). Waiting time = ((2-1)+(0-0) +( 5-3) +
(7-4)/4 = 1.5
Q2. Choose the correct statement about "Exponential Averaging" when predicting the next
CPU burst length in SJF scheduling.
(A) Exponential Averaging gives equal weight to all past CPU bursts.
(B) Exponential Averaging discards all previous history when predicting the next burst length.
(C) Exponential Averaging gives more weight to the recent CPU bursts while still considering
the entire history.
(D) Exponential Averaging is only applicable to non-preemptive scheduling algorithms.
(E) Exponential Averaging requires a fixed-size queue to store past burst lengths.
Answer: (C) Exponential Averaging gives more weight to the recent CPU bursts while still
considering the entire history.
Q3. The following processes are scheduled using the Robin process scheduling policy with a
time quantum of 3ms. Determine the average waiting time.
Process Arrival time Burst time
P 1 0 6
P 2 1 2
P 3 3 8
P 4 5 3
P 5 2 4
(A) 5.6
(B) 8.6
(C) 7.6
(D) 4.5
(E) 6.6
Q4. Assume the following processes are scheduled using the Priority Scheduling process
scheduling algorithm. Determine the average waiting time. Assume a lower value in priority
means higher priority.
Process Priority Burst time Arrival time
P 1 2 2 0
P 2 1 3 0
P 3 3 5 0
P 4 5 7 0
P 5 4 4 0
(A) 6.4
(B) 5.0
(C) 6.8
(D) 5.8
(E) 5.2
Answer: (A) 6.4
Explanation: P2(0-3) P1(3-5) P3(5-10) P5(10-14) P4(14-21)
Average waiting time = (3+0+5+14+10)/5 = 32/4 = 6.4
Q5. Which of the following process scheduling algorithms does not suffer from the starvation
problem?
(A) Shortest Job First (SJF)
(B) Priority Scheduling
(C) Shortest Remaining Time First (SRTF)
(D) First-Come First-Served (FCFS)
(E) Multilevel Queue Scheduling
Answer: (D) First-Come First-Served (FCFS)
Q6. The "Progress" condition in the context of the Critical Section Problem refers
(A) If no process is in the critical section and some processes wish to enter it, the selection of
the next process must not be indefinitely postponed.
(B) Only one process can be in the critical section at a time.
(C) No process should wait forever to enter the critical section.
(D) If a process is in the critical section, no other process can enter until it has finished.
(E) Processes must be allowed to enter the critical section based on their priority.
Answer: (A) If no process is in the critical section and some processes wish to enter it, the
selection of the next process must not be indefinitely postponed.
Q7. The “race condition” in the context of the critical section problem
(A) occurs when multiple processes enter their critical sections simultaneously, leading to
unpredictable results.
(B) happens when a process is forced to wait indefinitely before entering its critical section.
(C) arises when the OS fails to schedule processes fairly.
(D) refers to the situation where two or more processes compete for CPU.
(E) is a condition where a process preempts another process in the middle of its critical
section.
Answer: (A) occurs when multiple processes enter their critical sections simultaneously,
leading to unpredictable results.
Q8. The solution to the critical section problem ensures which of the following(s)?
(A) Mutual exclusion
(B) Progress
(C) Bounded waiting
(D) Mutual Exclusion and Progress
(E) Mutual exclusion, Progress, and Bounded waiting
Answer: (E) Mutual exclusion, Progress, and Bounded waiting
Q9. Consider the producer-consumer problem with a bounded buffer. The processes share a
variable “count”. The initial value of the count is 5, and the maximum size of the buffer is 10.
Producer process Consumer process
while (true) while (true)
{ {
/* produce an item in next produced */ while (count == 0) ;
while (count == BUFFER_SIZE) ; /* do nothing */
/* do nothing */ next_consumed = buffer[out];
buffer[in] = next_produced; out = (out + 1) % BUFFER_SIZE;
in = (in + 1) % BUFFER_SIZE; count = count - 1;
count = count +1; /* consume the item in the next consumed */
} }
The statement count = count + 1 is implemented as
SP0: register1 = count
SP1: register1 = register1 + 1
SP2: count = register1
The statement count = count - 1 is implemented as
SC0: register2 = count
SC1: register2 = register2 - 1
SC2: count = register2
Assume that the CPU schedules the producer-consumer problem as follows: SP0, SC0, SP1,
SC1, SP2, and SC2. What is the final value of the count?
(A) 6
(B) 4
(C) 5
(D) 3
(E) 2
Answer: (B) 4
Q10. To solve the critical section problem, the general structure of a process P includes
i
Assignment 7
Q1. Assume that two processes P and P trying to safely access a shared resource without
0 1
causing race conditions or data inconsistency. Here P and P share two variables: int turn, and
0 1
boolean flag[2]. Consider the structure of the process P and then choose the correct option.
1
do
{
flag[1] = true;
turn = 0;
while (flag[0] && turn ==0);
critical section
flag[1] = false;
remainder section
}
while (true);
(A) The above solution only achieves the mutual exclusion property.
(B) The above solution only achieves the progress requirement property.
(C) The above solution achieves only bounded-waiting property.
(D) The above solution is correct for solving the critical section problem for four processes.
(E) The above solution achieves mutual exclusion, progress requirement, and bounded-
waiting properties.
Answer: (E) The above solution achieves mutual exclusion, progress requirement, and
bounded-waiting properties.
Q8. Assume that we have two processes, P1 and P2. Consider the following pseudocode. Here
semaphore S1 = 1; semaphore S2 = 0.
P1() P2()
{ {
while (true) while (true)
{ {
wait(S1); wait(S2);
Critical section Critical section
signal(S2); signal(S2);
} wait(S2);
} Critical section
signal(S1);
}
}
(A) It will execute the process in the sequence P1P2P1P2P1P2....
(B) It will execute the process in the sequence P2P1P2P1P2P1....
(C) It will execute the process in the sequence P1P2P2P1P2P2....
(D) It will execute the process in the sequence P2P1P1P2P1P1....
(E) It will execute the process in the sequence P1P1P2P2P1P1P2P2....
Answer: (C) It will execute the process in the sequence P1P2P2P1P2P2....
Q9. Consider the following code snippets involving two processes, P1 and P2, that use wait()
and signal() operations on two semaphores, S1 and S2, both initialized to 1. Which of the
following scenarios can lead to a deadlock?
P1() P2()
{ {
wait(S1); wait(S2);
wait(S2); wait(S1);
Critical Section Critical Section
signal(S2); signal(S1);
signal(S1); signal(S2);
} }
(A) If P1 executes wait(S1) first, and P2 executes wait(S2) first.
(B) If both P1 and P2 execute wait(S1) first.
(C) If both P1 and P2 execute wait(S2) first.
(D) If P1 executes wait(S1) first, and P2 executes wait(S1) first.
(E) If P1 executes signal(S1) first, and P2 executes signal(S2) first.
Answer: (A) If P1 executes wait(S1) first, and P2 executes wait(S2) first.
Q10. Consider a system with two low-priority processes, P and Q, and one high-priority
process, R. Semaphores S1 and S2 are initialized to 1.
P() Q() R()
{ { {
wait(S1); wait(S2); wait(S1);
Critical section Critical section wait(S2);
signal(S1); signal(S2); Critical section
} signal(S2);
} signal(S1);
}
Which of the following statements best describes a scenario involving priority inversion and
deadlock?
(A) P and Q will always run before H because they have higher priority.
(B) R may experience priority inversion if it gets blocked by P or Q, but does not lead to a
deadlock.
(C) R may experience priority inversion if P and Q both run and hold semaphores S1 and S2,
respectively, leading to a situation where R is blocked, and it may also lead to a deadlock.
(D) The system will not experience priority inversion or deadlock because semaphores are
initialized to 1.
(E) R never experiences priority inversion.
Answer: (C) R may experience priority inversion if P and Q both run and hold semaphores S1
and S2, respectively, leading to a situation where R is blocked, and it may also lead to a
deadlock.
Assignment 8
Q1. How do we describe the “starvation” situation for the “Dining Philosophers” problem?
(A) A deadlock situation where philosophers cannot make progress
(B) When a philosopher asks to share the forks from his neighbour philosophers.
(C) When a philosopher cannot pick up any forks and, therefore, cannot eat.
(D) A situation where philosophers leave the table without finishing their meal.
(E) Philosophers eating continuously without thinking
Answer: (C) When a philosopher cannot pick up any forks and, therefore, cannot eat.
Q2. Which of the following conditions must be satisfied for a deadlock to occur in an operating
system?
(A) Mutual Exclusion
(B) Hold and Wait
(C) No Preemption
(D) Circular Wait
(E) All of the above
Answer: (E) All of the above
Q3. Consider the following Resource Allocation Graphs (RAGs). Here p1, p2, p3, and p4 are
the processes, and r1, r2, and r3 are are the resources. Each dot for a resource represents the
instance of that resource type.
(B) n operations
(C) log n operations
2
(D) n operations
2
Q8. Which of the following strategies is used to recover from the deadlock situation?
(A) Terminate all the deadlock processes.
(B) Terminate one process one at atime until the deadlock cycle is removed.
(C) Increase the priority of the process to eliminate the deadlock.
(D) Deallocate the resources from all the deadlock processes and allocate them to other
processes.
(E) All of the above.
Answer: (E) All of the above.
Q9. Which data structure is not needed to execute the Banker’s Algorithm?
(A) Available matrix
(B) Maximum resource matrix
(C) Allocation matrix
(D) Need matrix
(E) Prority matrix
Answer: (E) Prority matrix
Q10. A computer system has four types of resources: A, B, C, and D. The system currently has
13 instances of resource A, 7 instances of resource B, 6 instances of resource C, and 7
instances of resource D available. Consider the following snapshot of a system:
Assignment 9
Q1. Assume that the computer system’s memory includes eight pages, and each page size is
1KB. The size of the physical memory is thirty-two pages. The number of bits required to
represent the logical address and physical address are
(A) 13 bits and 15 bits
(B) 12 bits and 16 bits
(C) 14 bits and 14 bits
(D) 11 bits and 17 bits
(E) 16 bits and 12 bits
Answer: (A) 13 bits and 15 bits
[No. of page is 8, size is 1KB, size of logical memory 8 × 1024 = 2 Bytes. No of pages = 32,
13
Q3. Assume that a computer system uses m bits for logical address and n bits for physical
address. The logical address space size is 2 bytes, and the page size is 2 bytes. The number
m n
Q5. Assume that a computer system uses a paging scheme. The page size 4KB. The size of the
user process is 50000 bytes. What amount of memory will be wasted?
(A) 1632 Bytes
(B) 2048 bytes
(C) 3048 bytes
(D) 3248 Bytes
(E) 4092 Bytes
Answer: (D) 3248 Bytes
[Page size = 4KB = 4096 bytes. Total page required = 50000/4096 = 12.20 = 13 page. Allocated
memory = 13 pages × 4 KB/page = 18 × 4,096 bytes = 53248 bytes. Internal fragmentation =
73,728 bytes - 72,500 bytes = 1,228 bytes. Internal fragmentation = 53248 - 50000 bytes =
3248 bytes.]
Q6. Assume that a computer system is using the two-level paging scheme. The size of the
page is 4KB. Assume that the size of each entry in page tables is 4 bytes. The computer system
used a 64-bit logical address and a 64-bit physical address. The first-level page table has 232
entries, and each second-level page table also has 2 entries. The system uses a single MMU
20
register for the first-level page table entry. What is the size of the total memory consumed by
the first-level and second-level page tables?
(A) 16GB and 4MB
(B) 4MB and 15GB
(C) 8GB and 8GB
(D) 16GB and 4GB
(E) 16GB and 16GB
Answer: (A) 16GB and 4MB
[Size of the first-level page table = 2 × 4 bytes = 2 × 2 Bytes = 16GB. second-level page table
32 30 4
Q7. Assume that a computer system follows “fixed variable multiple partitions” memory
allocation method. The memory is partitioned as follows (in order):
Block Number Block Size
1 200KB
2 350KB
3 100KB
4 400KB
5 375KB
The Best-fit memory management algorithm places the following processes of size 218KB,
410KB, 115KB, 345KB, and 100KB (in order). What is the amount of internal and external
fragmentations?
(A) 600KB and 47KB
(B) 47KB and 400KB
(C) 47KB and 200KB
(D) 47KB and 600KB
(E) 200KB and 400KB
Answer: (D) 47KB and 600KB
[Processes 218KB and 115KB will be fitted in Blok 2. Process 345KB will be fitted in block 5.
Process 410KB can’t be fitted in any block. Process 100KB is fitted with Block 3. Therefore,
International fragmentation is = (350 - (218+115)) + (100-100) + (375-345) = 17 + 30 = 47KB.
External fragmentation is (200+400) = 600KB.]
Q10. The Page-Table Length Register (PTLR) is used in the paging scheme to
(A) hold the number of pages currently in use
(B) hold the base address of the page table
(C) manage the cache for page table entries
(D) store the addresses of the page table entries
(E) indicate the length of the page table in memory
Answer: (E) indicate the length of the page table in memory
Assignment 10
Q1. In a paging system with TLB. It takes 30ns to search the TLB, and 50ns to search for access
to the memory. If the TLB hit ratio is 85%, what is the effective memory access time?
(A) 83ns
(B) 87.5ns
(C) 85.5ns
(D) 84ns
(E) 80.5ns
Answer: (A) 83ns
[TLB hit time = Time to access TLB + Time to access memory = 30 ns + 50 ns = 80 ns. TLB miss
time = Time to access memory twice (one for page table lookup, one for actual memory
access) = 2 × 50 ns = 100ns. TLB hit ratio = 85% = 0.85. TLB miss ratio = 15% = 0.15. Effective
Memory Access (EAT) time = (0.85 × 80ns) + (0.15 × 100ns) = 83ns]
Q2. A computer system with 512 bytes of main memory runs a process with four segments of
unequal size. The process is loaded in the main memory using the following segment table.
Segment number Base Address (in decimal) Length (in bytes)
0 20 40
1 80 50
2 135 30
3 180 100
If the computer system uses the 11-bit addresses, what is the physical address corresponding
to the logical address 11000001101?
(A) 011001001
(B) 011001100
(C) 111001101
(D) 011001101
(E) Address is out of the segment
Answer: (D) 011001101
[Total number of segments is 4 = 2 . Therefore, the initial 2 bits (the two most significant
2
bits) represent the segment number. If the logical address is 11000001101, then the
segment number is 11, i.e., 3. The remaining 9 bits, i.e., 000001101 map to the actual
physical address. The decimal equivalent of 000001101 is 25. Segment 3 has a base address
of 180 (decimal). Therefore, 010011001 represents the physical address 180 + 25 = 205, i.e.,
011001101.]
Q3. Choose the correct statement for the hashed page table.
(A) It is primarily used in systems with small address spaces.
(B) It stores page table entries in a contiguous memory block.
(C) Each hashed table entry stores only the frame number of the corresponding page.
(D) It is generally faster than an inverted page table.
(E) It uses the virtual page number to compute the hash value, which determines the location
in the table.
Answer: (E) It uses the virtual page number to compute the hash value, which determines the
location in the table.
Q4. The physical address in an inverted page table memory management scheme is the
combination of
(A) process id and virtual page number
(B) index of the page table and virtual page number
(C) index of the page table and offset
(D) index of the page table and process id
(E) None of these
Answer: (C) index of the page table and offset
Q6. The Effective Memory Access time for the Demand paging scheme is directly affected by
(A) degree of multi-programming
(B) number of pages
(C) number of frames
(D) size of memory
(E) page fault rate
Answer: (E) page fault rate
Q7. Choose the main benefit of using a hierarchical (multi-level) paging scheme over a single-
level paging scheme.
(A) It decreases the page fault rate
(B) It reduces memory access overhead
(C) It decreases the page table size
(D) It improves the physical memory utilization
(E) It simplifies the address translation process
Answer: (C) It decreases the page table size
Q9. Assume that a computer system uses an inverted page table for memory management.
The system uses a 16-bit virtual address, and each virtual address is of the form <process id,
virtual page number, offset>. The size of process id, virtual page number, and offset are 4 bits,
6 bits, and 6 bits, respectively. Assume that the system uses the physical address of 9 bits.
The page table of the system is given below.
Index (3 bits) Process id (4 bits) Virtual page number (6 bits)
000 0000 000111
001 1001 111001
010 0010 101010
011 1010 110011
100 0100 011100
101 1101 100101
110 0110 100110
111 1111 010111
If the CPU generates the virtual address 1010100101101010, what is the corresponding
physical address?
(A) 011101010
(B) 110101010
(C) 000101010
(D) 011101111
(E) 011111110
Answer: (A) 011101010
[The virtual address is 1010100101101010. Therefore, pid is 1010. The vpn is 100101, and
the offset is 101010. The pid will give the index in the page table. Here, the pid is 1010,
indicating the index is 011. The physical address is <index||offset>, and so 011101010 is the
physical address.]
Q10. Which actions occur when a page fault happens in a demand paging system?
(A) The process is terminated immediately.
(B) The requested page is loaded from secondary storage into physical memory.
(C) The process is suspended until all pages are swapped out.
(D) The page table entry is marked as invalid.
(E) The physical memory is immediately allocated to the process.
Answer: (B) The requested page is loaded from secondary storage into physical memory.
Assignment 11
Q1. Assuming that the memory frames are initially empty, for the page reference string: 5, 0,
2, 1, 0, 3, 0, 2, 4, 3, 0, 3, 2, 1, 3. Compute the number of page faults in the FIFO page
replacement policy with three memory frames.
(A) 11
(B) 12
(C) 13
(D) 14
(E) 15
Answer: (C) 13
str ref. 5 0 2 1 0 3 0 2 4 3 0 3 2 1 3
f0 5 5 5 1 1 1 1 2 2 2 0 0 0 0 3
f1 0 0 0 0 3 3 3 4 4 4 4 2 2 2
f2 2 2 2 2 0 0 0 3 3 3 3 1 1
Page fault? Y Y Y Y N Y Y Y Y Y Y N Y Y Y
Q2. Calculate the page fault rate for the following reference string: 5, 0, 2, 1, 0, 3, 0, 2, 4, 3, 0,
3, 2, 1, 3, using the optimal page-replacement algorithm with three frames.
(A) 40%
(B) 46.66%
(C) 60%
(D) 66.66%
(E) 53.33%
Answer: (E) 53.33%
str ref. 5 0 2 1 0 3 0 2 4 3 0 3 2 1 3
f0 5 5 5 1 1 3 3 3 3 3 3 3 3 3 3
f1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
f2 2 2 2 2 2 2 4 4 4 4 2 1 1
Page fault? Y Y Y Y N Y N N Y N N N Y Y N
Page fault rate = (8/15) × 100 = 53.33%
Q3. Consider a computer system executing a process of size 12KB in the main memory with
the following page reference strings: 5, 0, 2, 1, 0, 3, 0, 2, 4, 3, 0, 3, 2, 1, 3. The size of each
page is 4KB. Compute the number of page fault rate for the Least Recently Used (LRU) page
replacement algorithm for three frames.
(A) 46.66%
(B) 66.66%
(C) 53.33%
(D) 73.33%
(E) 63.33%
Answer: (D) 73.33%
str ref. 5 0 2 1 0 3 0 2 4 3 0 3 2 1 3
f0 5 5 5 1 1 1 1 2 2 2 0 0 0 1 1
f1 0 0 0 0 0 0 0 0 3 3 3 3 3 3
f2 2 2 2 3 3 3 4 4 4 4 2 2 2
Page fault? Y Y Y Y N Y N Y Y Y Y N Y Y N
Page fault rate = (11/15) × 100 = 73.33%
Q4. Consider a computer system with 12KB of main memory, and each frame/page size is
4KB. Assume that a process of size 20KB will be executed in the main memory with the
following page reference string 0, 1, 2, 3, 4, 1, 2, 0, 1, 2, 1, 4, 1. Compute the page fault rate
for the second-chance (clock) page replacement algorithm.
(A) 60%
(B) 50%
(C) 40%
(D) 70%
(E) 55%
Answer: (A) 60%
str 0 1 2 3 4 1 2 0 1 2 1 4 1
ref.
f0 0(0 0(0 →0(0 3(0) 3(0) →3(0 2(0) 2(0) 2(0) 2(1) 2(1) 2(1) →2(0
) ) ) ) )
f1 → 1(0 1(0) →1(0 4(0) 4(0) →4(0 0(0) 0(0) 0(0) 0(0) 4(0) 4(0)
) ) )
f2 → 2(0) 2(0) →2(0 1(0) 1(0) →1(0 →1(1 →1(1 →1(1 →1(0 1(1)
) ) ) ) ) )
Page Y Y Y Y Y Y Y Y N N N Y N
fault
?
Page fault rate = (9/15) × 100 = 60%
Q5. Assume that a computer system executes three processes P , P , and P . The P , P , and P
1 2 3 1 2 3
processes are allocated 32, 189, and 65 pages. The size of each frame is 4KB. The size of the
physical frame is 460KB. How many frames will be allocated to each process following the
“Proportional allocation” strategy?
(A) 13, 76, and 26
(B) 13, 75, and 27
(C) 12, 76, and 27
(D) 32, 189, and 65
(E) 14, 74, and 27
Answer: (A) 13, 76, and 26
Number of frames = 460/4 = 115. S = 32+189+65=286. P gets = (32/286) × 115 = 12.86 ≈ 13
1
frames. P gets = (189/286) × 115 = 75.99 ≈ 76 frames. P gets = (65/286) × 115 = 26.13 ≈ 26
2 3
frames.]
Q7. Choose the correct statement concerning the Enhanced Second-Chance page
replacement algorithm.
(A) It is a modification of the FIFO page replacement algorithm.
(B) It uses reference and modification (dirty) bits to decide which page to replace.
(C) Pages with reference and modification bits set to 1 are replaced first.
(D) It only uses the reference bit to determine if a page gets a second chance.
(E) It does not consider the modification bit during page replacement.
Answer: (B) It uses reference and modification (dirty) bits to decide which page to replace.
Q8. Assume that a computer system executes a process in the main memory with the
following page reference strings: 3, 3, 4, 2, 3, 5, 3, 5, 1, 4. The initial working set window size
(∆) is 4. The initial working set window at time t = 0 contains the pages {5,4,1}, where
page 5 was referenced at time t = -2, page 4 at time t = −1, and page 1 at time t = 0. What is
the total number of page faults and the average number of page frames used by computing
the working set at each reference?
(A) 5 and 3.5
(B) 5 and 4.5
(C) 6 and 3.2
(D) 5 and 3.2
(E) 4 and 4.2
Answer: (D) 5 and 3.2
Q1. Suppose that a disk drive has 200 cylinders numbered 0 to 199. Consider a disk queue
with I/O requests on the following cylinders in their arriving order: 54, 95, 73, 130, 25, 48,
110, 30, 45, 180, and 190. The disk head is assumed to be at cylinder 24. Starting from the
current head position, what is the total distance (in cylinders) the disk arm moves to satisfy
all the pending requests for the FCFS disk-scheduling algorithm?
(A) 580 cylinders
(B) 589 cylinders
(C) 643 cylinders
(D) 570 cylinders
(E) 585 cylinders
Answer: (A) 580 cylinders
[The read/write head moves as follows: 24 → 54 → 95 → 73 → 130 → 25 → 48 → 110 → 30
→ 45 → 180 → 190. Total head movement is (54-24)+(95-54)+(95-73)+(130-73)+(130-
25)+(48-23)+(110-48)+(110-30)+(45-30)+(180-45)+(190-180) = 30 + 41 + 22 + 57 + 105 + 23 +
62 + 80 + 15 + 135 + 10 = 580 cylinders.]
Q2. In a demand-paging system, the paging device has an average latency of 6ms, seek time
of 5ms, and transfer time of 0.1ms. The disk has a queue of waiting processes. The average
waiting time is 5ms. If the memory access time is 150ns and the page fault rate is 10%. The
effective memory access time is
(A) 1.61ms
(B) 1.22ms
(C) 2.712ms
(D) 1.50ms
(E) 1.45ms
Answer: (A) 1.61ms
[Page fault service time is (6+5+0.1+5) = 16.10ms. Memory access time = 150ns =
0.000150ms. EAT = (0.10 × 16.10) + (1-0.10) ×0.00015 = 1.610135ms = 1.61ms]
Q3. Suppose that a disk drive has 500 cylinders numbered 0 to 499. The drive currently serves
a request at cylinder 143; the previous request was at cylinder 125. The queue of pending
requests, in FIFO order, is 86, 170, 213, 474, 148, 109, 222, 450, and 330. Starting from the
current head position, what is the total distance (in cylinders) the disk arm moves to satisfy
all the pending requests for the SSTF disk-scheduling algorithm?
(A) 680 cylinders
(B) 580 cylinders
(C) 700 cylinders
(D) 750 cylinders
(E) 719 cylinders
Answer: (E) 719 cylinders
[The current head position is at cylinder 143. The head will move to cylinder 148 with a
minimum seek distance |148 − 143| = 5. Therefore, the SSTF schedule is 170, 213, 222, 330,
450, 474, 109, and 86. The total seek distance is |148 - 143| + |170 - 148| + |213 - 170| + |222 -
213| + |330 - 222| + |450 - 330| + |474 - 450| + |109 - 474| + |86 - 109| = 719 cylinders.]
Q4. Suppose that a disk drive has 140 cylinders numbered 0 to 139. Consider a disk queue
with requests for I/O to blocks on cylinders 6, 10, 12, 54, 97, 73, 128, 15, 44, 110, 34, and 45
in that order. Assume that the head is moving toward decreasing the order of the cylinder
numbers. Initially, the disk head is at cylinder 20. Starting from the current head position,
what is the total distance (in cylinders) the disk arm moves to satisfy all the pending requests
for the SCAN disk-scheduling algorithm?
(A) 150 cylinders
(B) 155 cylinders
(C) 158 cylinders
(D) 165 cylinders
(E) 170 cylinders
Answer: (C) 158 cylinders
[The read/write head is moved as follows: 20 → 15 →12 →10 →6 →0 →34 →44 →45 →54
→73 →97 →110 →128 →139. Total read/write movement is |20-15|+|15-12|+|12-
10|+|10-6|+|6-0|+|34-0|+|44-34|+|45-44|+|54-45|+|73-54|+|97-73|+|110-97|+|128-
110|+|139-128|= 5+3+2+4+6+34+10+1+9+19+24+13+18=158 cylinders.]
Q5. Suppose that a disk drive has 500 cylinders numbered 0 to 499. Consider a disk queue
with requests for I/O to blocks on cylinders 10, 120, 147, 312, 180, 444, 355, 470, 290, and
170, in that order. Assume that the head is moving toward decreasing the order of the
cylinder numbers. Initially, the disk head is at cylinder 100. Starting from the current head
position, what is the total distance (in cylinders) the disk arm moves to satisfy all the pending
requests for the C-SCAN disk-scheduling algorithm?
(A) 1328 cylinders
(B) 1220 cylinders
(C) 1350 cylinders
(D) 1380 cylinders
(E) 1280 cylinders
Answer: (A) 1328 cylinders
[The read/write head is moved as follows: 100 →10 →0 →499 →120 →147 →170 →180
→290 →312 →355 →444 →470. Total read/write head movement is |100 - 10|+ |10 -
0|+|499-0|+|499 - 120|+ |147 - 120|+ |170 - 147|+ |180 - 170|+ |290 - 180|+ |312 - 290|+ |355 -
312|+ |444 - 355|+ |470 - 444|= 90 + 10 + 499 + 379 + 27 + 23 + 10 + 110 + 22 + 43 + 89 + 26 =
1328 cylinders.]
Q6. Suppose that a disk drive has 400 cylinders numbered 0 to 399. Consider a disk queue
with I/O requests on the following cylinders in their arriving order: 26, 120, 226, 354, 197,
373, 228, 315, 244, 110, 34, and 45. The read/write head is positioned at cylinder 123 and
moving in the direction of decreasing cylinder number. Starting from the current head
position 123, what is the total distance (in cylinders) the disk arm moves to satisfy all the
pending requests for the LOOK disk-scheduling algorithm?
(A) 345 cylinders
(B) 245 cylinders
(C) 444 cylinders
(D) 440 cylinders
(E) 340 cylinders
Answer: (C) 444 cylinders
[The read/write head is moved as follows: 123 → 120 → 110 → 45 → 34 → 26→197 → 226 →
228 → 244 → 315 → 354 → 373. Total head movement is (123-120)+(120-110)+(110-45)+(45-
34)+(34-26)+(197-26)+(226-197)+(228-226)+(244-228)+(315-244)+(354-315)+(373-354) = 3 +
10 + 65 + 11 + 8 + 171 + 29 + 2 + 16 + 71 + 39 + 19 = 444 cylinders]
Q7. Suppose that a disk drive has 200 cylinders numbered 0 to 199. Consider a disk queue
with I/O requests on the following cylinders in their arriving order: 54, 95, 73, 130, 25, 48,
110, 30, 45, 180, and 190. The read/write head is positioned at cylinder 43 and moving in the
direction of decreasing cylinder number. Starting from the current head position 43, what is
the total distance (in cylinders) the disk arm moves to satisfy all the pending requests for the
C-LOOK disk-scheduling algorithm?
(A) 328 cylinders
(B) 324 cylinders
(C) 320 cylinders
(D) 316 cylinders
(E) 312 cylinders
Answer: (A) 328 cylinders
[The read/write head is moved as follows: 43 → 30 → 25 → 190 → 180 → 130 → 110 → 95
→ 73 → 54 → 48 → 45. Total head movement is (43-30) + (30-25) + (190-25) +(190-180) +
(180-130) +(130-110) +(110-95) +(95-73) +(73-54) +(54-48) + (48-45) = 13 + 5 + 165 + 10 + 50
+ 20 + 15 + 22 + 19 + 6 + 3 = 328 cylinders.]
Q8. Choose the disk space allocation methods that allow efficient random access to file blocks
and minimise external fragmentation.
(A) Contiguous Allocation
(B) Linked Allocation
(C) Indexed Allocation
(D) File Allocation Table (FAT)
(E) Free Space Management
Answer: (C) Indexed Allocation
Q9. When the object files have been linked properly and are ready to run, they are known as
(A) archive files
(B) batch files
(C) object files
(D) executable files
(E) library files
Answer: (D) executable files
(A) Keyboard
(E) Microphone
Accepted Answers:
(D) Arithmetic-logic unit
(A) Printer
(B) Monitor
(C) Speaker
(D) Headphone
Which of the following task is not performed by the arithmetic-logic unit (ALU)?
(A) JAVA
(B) Python
(C) Machine/Binary
(D) C++
(E) FORTRAN 77
Accepted Answers:
(C) Machine/Binary
Which of the following is the main component or brain of the computer system?
(C) CPU
(A) hold the address of the current instruction executed by the processor
(B) hold the address of the next instruction to be executed by the processor
(A) hold the address of the next instruction to be executed by the processor
(B) hold the address of the current instruction to be fetched from the memory
(C) hold the data to be used by the processor at the next clock cycle
(D) hold (temporarily) the data being processed and the results of calculations
(E) help to exchange the data between an I/O device and the processor
Accepted Answers:
(B) hold the address of the current instruction to be fetched from the memory
What will be the output of the following program code?
#include<stdio.h>
int main()
{
float x = 20.20;
void *p = &x;
printf("%f\n", (float)*p);
return 0;
}
(D) 20.20
(E) 20
Accepted Answers:
(A) Compile-time error
What is the pointer equivalent expression of a[i]?
(A) *(a+i)
(B) (a+i)
(C) &(a+i)
(D) (a[0]+i)
(E) *a+i
Accepted Answers:
(A) *(a+i)