operating system gate questions with solution
Operating System Gate Questions

Operating System GATE Questions with Solution- SET1

Operating System GATE Questions – Set1

  • The operating system gate questions are important to practice for GATE exam.
  • Operating System is a scoring subject for the GATE Computer Science Exam.
  • In this tutorial, we are going to discuss Operating System GATE questions with solution and explanations.
  • Questions based on CPU Scheduling, page replacement Algorithms, process synchronization, and disk scheduling algorithms are generally asked in the GATE exam from the operating system subject.

In this SET 1 of Operating System GATE exam questions, we have discussed Process, CPU Scheduling, and Page Replacement Algorithm questions.

Operating System GATE Questions with Solution

Questions 1 . A computer system manages various interrupt sources of interrupts . Consider the following statement and select the right answer. (GATE 2011) 

Interrupt from CPU temperature sensor ( raises interrupt if CPU temperature is too high)

Interrupt from Mouse  is raised if the mouse is moved or a button is pressed

Interrupt from Keyboard is raised Interrupt if a key is pressed or released

Interrupt from Hard Disk raises Interrupt when a disk read is completed

Which one of these will be handled at the HIGHEST priority?

(A) Interrupt from Hard Disk     (B) Interrupt from Mouse

(C) Interrupt from Keyboard  (D) Interrupt from CPU temp sensor

Answer – D 

Explanation

Higher priority interrupt levels should be handled and if delayed or interrupted could have serious consequences

if delayed interrupt handling of CPU temperature sensor then it may cause some  serious consequences such as overheat which can damage CPU circuitry.

In the given question priority order of interrupt handling are given below

    CPU temperature sensor > Hard Disk > Mouse > Keyboard

Question 2 – Consider the following table of arrival time and burst time for three processes P0,P1 and P2.               (GATE 2011)   

Process      Arrival time    Burst Time
P0                 0 ms             9 ms
P1                1 ms              4ms
P2                 2 ms             9ms

If pre-emptive shortest job first scheduling algorithm is used. Scheduling is
carried out only at arrival or completion of processes. What is the average
waiting time for the three processes?

(A) 5.0 ms (B) 4.33 ms (C) 6.33 ms (D) 7.33 ms

Answer – A

Explanation

since we are using preemptive shortest job first ( SRTF)

at time t=0 only one process P0 was there so CPU start to execute it.

At time t=1 , process P1 is submitted and since burst time of P1(4 is less than remaining time of P0( 8) so cpu will  now execute P1

At time t=1 process p2 is submitted and since burst time of P2 (9 ms) is greater than remaining time of P1( 3) so cpu will  now execute P1

So first P1 process will be completed than remaining time of P0 (8) is less than remaining time of p2(9) so CPU will execute to P0 in the last CPU will execute to pocess P2

operating system gate 2011 question

Question 3 – A process execute the code                      GATE 2012

fork();

fork();

fork();

Total number of child process created is

(a) 3   (b) 4   (c) 7    (d) 8

Answer – C

Explanation

If the fork() is called n times then total nuber of running process power(2,n) inlcuding parent process so there will be [ power(2,n)-1] process

for the above question value of n is 3 so (8-1=7) child process will be created.

Question 4 – Consider the given virtual page reference string          ( GATE 2012)

1,2,3,2,4,1,3,2,4,1

on a demand paged virtual memory system running on a computer system that
has main memory size of 3 page frames which are initially empty.

Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacement policy.

Then

(A) OPTIMAL < LRU < FIFO
(B) OPTIMAL = LRU
(C) OPTIMAL < FIFO < LRU
(D) OPTIMAL = FIFO

Answer – C

Explanation

Using FIFO Page replacement Algorithm

1 1 1   4  4  4
2 2   2  1  1       (6) faults
3   3  3  2

Using Optimal Page Replacement Algorithm

1 1 1   1   1
2 2   4   4     (5) faults
3   3    2

LRU  Page Replacement

1 1 1   4   4  4  2  2   2
2 2   2   2  3  3  3   1           (9) faults
3   3   1  1  1  4   4

Optimal < FIFO < LRU

Question 5 – Consider the 3 process, P1, P2 and P3 shown in the table.

Process       Arrival Time             Burst Time
P1                     0                                 5
P2                     1                                 7
P3                     3                                 4

The completion order of the 3 processes under the policies FCFS and RR2 (round
robin scheduling with CPU quantum of 2 time units) are    ( GATE 2013)

(A) FCFS: P1, P2, P3 RR2: P1 I P2, P3
(B) FCFS: P1, P3, P2 RR2: P1, P3, P2
(C) FCFS: P1, P2, P3 RR2: P1, P3, P2
(D) FCFS: P1 I P3, P2 RR2: P1, P2, P3

Answer – C

Explanation –  

 

Operating System Gate 2012

In case of round robin at time t= 2 , process P1 will be interrupted and submitted to ready queue since P3 is arrived at t= 3 in ready queue and P1 at t=2 so first P1 will get chance to execute at t=4 after P2.

Question 6 – If there is a scheduling algorithm which assigns priority proportional to the waiting time of a process. If Every process starts with priority zero which is the lowest priority.

The scheduler re-evaluates the process priorities every T time units and decides the next process to schedule.

Which among the following is TRUE if the processes assume that process have no I/O operations and all process submitted at time zero. ( GATE 2016)

(A) This algorithm will be equivalent to the first-come-first-serve algorithm.
(B) This algorithm will be equivalent to the round-robin algorithm.
(C) This algorithm will be equivalent to the shortest-job-first algorithm.
(D) This algorithm will be equivalent to the shortest-remaining-time-first  algorithm.

Ans: (B)

Explanation : Since the given scheduling assign priority dynamically to process priority and the other is ‘T’ time unit to re-evaluate the process priorities. This dynamically assigned priority will be deciding processes order in ready queue of round robin algorithm whose time quantum is same as ‘T’ time units.

As all the processes are submitted at the same time, they will be given same priority but soon after first ‘T’ time burst remaining processes will get higher priorities.

Question 6 – How many maximum number of processes can be in READY state on if there are n CPUs is ?  Gate 2015

(A) n    (B) n −1    (C) 2 ^ n    (D) Independent of n

Answer : (D)

Explanation : Number of processes which are in running processes will be at most n if there are n processors. But the Maximum no. of processes that will be in ready state does not depend on number of CPUs.

Conclusion and Summary

  • In this tutorial we have discussed operating system gate questions with solution.
  • Questions based on CPU Scheduling, Process and Page Replacement Algorithms are explained with solution

Leave a Reply

Your email address will not be published. Required fields are marked *