Operating Systems questions — page 1 of 7

Q29

GATE CS 2026 CS-1DeadlocksMSQ1 mark
With respect to deadlocks in an operating system, which of the following statements is/are FALSE?
More than one option can be correct.
Show answer without attempting

Answer: A, C

Q35

GATE CS 2026 CS-1DeadlocksNAT1 mark
Consider a system consisting of kk instances of a resource RR, being shared by 5 processes. Assume that each process requires a maximum of two instances of resource RR and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance.

The minimum value of kk for the system to be deadlock-free is ________. (answer in integer)
Show answer without attempting

Answer: 6

Q54

GATE CS 2026 CS-1Memory ManagementMSQ2 marks
Consider a system that has a cache memory unit and a memory management unit (MMU). The address input to the cache memory is a physical address. The MMU has a translation lookaside buffer (TLB). Assume that when a page is evicted from the main memory, the corresponding blocks in the cache are marked as invalid.

For a given memory reference, which of the following sequences of events can NEVER happen?
More than one option can be correct.
Show answer without attempting

Answer: B, C

Q59

GATE CS 2026 CS-1File SystemsNAT2 marks
Consider a hard disk with a rotational speed of 15000 rpm. The time to move the read/write head from a track to its adjacent track is 1 millisecond. Initially, the head is on track 0. The number of sectors per track is 400. The sector size is 1024 bytes. It is necessary to transfer data from 10 randomly located sectors in each of the following tracks in the order: 5, 12 and 7.

The total time for the data transfer (in milliseconds) from the hard disk is _________. (rounded off to one decimal place)
Show answer without attempting

Answer: 77.3

Q63

GATE CS 2026 CS-1Processes and ThreadsNAT2 marks
Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the fork() system call is always successful in creating a process.
int main () {
 int i;
 for (i = 0; i < 3; i++){
 if (fork() == 0){
 continue;
 }
 break;
 }
 printf("Hello!");
 return 0;
}
The total number of times that the printf statement gets executed is ________. (answer in integer)
Show answer without attempting

Answer: 4

Q64

GATE CS 2026 CS-1SchedulingNAT2 marks
Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst of 8 seconds. A new process of type A arrives at time t=10,20,30,40,and 50t = 10, 20, 30, 40, \text{and } 50 (in seconds). Similarly, a new process of type C arrives at time t=11,22,33,44,and 55t = 11, 22, 33, 44, \text{and } 55 (in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at t=10t = 10 seconds. The average waiting time (in seconds) for the 10 processes is ___________. (rounded off to one decimal place)
Show answer without attempting

Answer: 9.5

Q23

GATE CS 2026 CS-2SchedulingMCQ1 mark−1/3 if wrong
Which one of the following CPU scheduling algorithms cannot be preemptive?
Show answer without attempting

Answer: B

Q51

GATE CS 2026 CS-2Concurrency and SynchronizationMSQ2 marks
Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A and B are two binary semaphores initialized to 1 and 0, respectively. X is a shared variable initialized to 0. Each line in the pseudocode is executed atomically.

Pseudocode of P1, P2, and P3
 Wait(A);
 Print(*);
 X = X+1;
 If (X == 2)
 {
 Print($);
 Signal(B);
 }
 Signal(A);
 Wait(B);
 Print(#);
 Signal(B);
Assume that any of the three processes can start to execute first and context switching can happen between these processes at any arbitrary time and in any arbitrary order.

Which of the following patterns is/are possible to be generated as an outcome of the execution of these three processes?
More than one option can be correct.
Show answer without attempting

Answer: A, B, C

Q53

GATE CS 2026 CS-2File SystemsNAT2 marks
To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is ____________. (answer in integer)

Note: 1K=2101\text{K}=2^{10} and 1G=2301\text{G}=2^{30}
Show answer without attempting

Answer: 16417

Q54

GATE CS 2026 CS-2Memory ManagementNAT2 marks
A system has a Translation Lookaside Buffer (TLB) that has a reach of 1 MB. TLB reach is defined as the total amount of physical memory that can be accessed through the TLB entries. The paging system uses pages of size 4 KB. The virtual address space is 64 GB and physical address space is 1 GB. If each TLB entry stores a 4-bit process id, page number, frame number, and a 2-bit control field, then the size of the TLB (in bytes) is ___________. (answer in integer)

Note: 1K=210,1M=220,1G=2301\text{K}=2^{10}, 1\text{M}=2^{20}, 1\text{G}=2^{30}
Show answer without attempting

Answer: 1536

Q55

GATE CS 2026 CS-2Memory ManagementNAT2 marks
Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 8 holes in the memory of sizes 20 KB, 4 KB, 25 KB, 18 KB, 7 KB, 9 KB, 15 KB, and 12 KB. Assume that no two holes are adjacent. Two processes P1 of size 16 KB and P2 of size 9 KB arrive in that order, and they are allocated memory using the best-fit technique. After allocating space to P1 and P2, the number of holes of size less than 8 KB is ____________. (answer in integer)

Note: 1K=2101\text{K}=2^{10}
Show answer without attempting

Answer: 3

Q14

GATE CS 2025 CS-1Memory ManagementMCQ1 mark−1/3 if wrong
Consider a demand paging memory management system with 32-bit logical address, 20-bit physical address, and page size of 2048 bytes. Assuming that the memory is byte addressable, what is the maximum number of entries in the page table?
Show answer without attempting

Answer: A

Q29

GATE CS 2025 CS-1Processes and ThreadsNAT1 mark
Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _______. (Answer in integer)
int main()
{
 int x=0,i=0;
 scanf("%d",&x);
 for(i=0; i<20; i++)
 {
 x = x+20;
 printf("%d
",x);
 }
 return 0;
}
Show answer without attempting

Answer: 21

Q38

GATE CS 2025 CS-1SchedulingMCQ2 marks−2/3 if wrong
A computer has two processors, M1M_1 and M2M_2. Four processes P1,P2,P3,P4P_1, P_2, P_3, P_4 with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:
- M1M_1 uses priority of execution for the processes as, P1>P3>P2>P4P_1 > P_3 > P_2 > P_4, i.e., P1P_1 and P4P_4 have highest and lowest priorities, respectively.
- M2M_2 uses priority of execution for the processes as, P2>P3>P4>P1P_2 > P_3 > P_4 > P_1, i.e., P2P_2 and P1P_1 have highest and lowest priorities, respectively.
A process PiP_i is scheduled to a processor MkM_k, if the processor is free and no other process PjP_j is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?
Show answer without attempting

Answer: A

Q51

GATE CS 2025 CS-1Memory ManagementNAT2 marks
A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1M bytes needs to be stored in the disk. Assume, 1K=2101\text{K} = 2^{10} and 1M=2201\text{M} = 2^{20}. The amount of space in bytes that will be wasted due to internal fragmentation is ______. (Answer in integer)
Show answer without attempting

Answer: 65468

Q54

GATE CS 2025 CS-1Memory ManagementNAT2 marks
In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal page replacement algorithm is as follows:
The OS correctly predicts only up to next 4 page references (including the current page) at the time of allocating a frame to a page.
A process accesses the pages in the following order of page numbers:
1, 3, 2, 4, 2, 3, 1, 2, 4, 3, 1, 4.
If the system has three memory frames that are initially empty, the number of page faults that will occur during execution of the process is ________ . (Answer in integer)
Show answer without attempting

Answer: 6

Q26

GATE CS 2025 CS-2SchedulingMCQ1 mark−1/3 if wrong
Processes P1,P2,P3,P4P1, P2, P3, P4 arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.

Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?
Show answer without attempting

Answer: D

Q47

GATE CS 2025 CS-2Memory ManagementMSQ2 marks
Consider a demand paging system with three frames, and the following page reference string: 1  2  3  4  5  4  1  6  4  5  1  3  21 \; 2 \; 3 \; 4 \; 5 \; 4 \; 1 \; 6 \; 4 \; 5 \; 1 \; 3 \; 2. The contents of the frames are as follows initially and after each reference (from left to right), as shown in the table:

The *-marked references cause page replacements.

Which one or more of the following could be the page replacement policy/policies in use?
Question figure
More than one option can be correct.
Show answer without attempting

Answer: D

Q48

GATE CS 2025 CS-2DeadlocksMSQ2 marks
P={P1,P2,P3,P4}P = \{P_1, P_2, P_3, P_4\} consists of all active processes in an operating system.
R={R1,R2,R3,R4}R = \{R_1, R_2, R_3, R_4\} consists of single instances of distinct types of resources in the system.

The resource allocation graph has the following assignment and claim edges.

Assignment edges: R1→P1,R2→P2,R3→P3,R4→P4R_1 \rightarrow P_1, R_2 \rightarrow P_2, R_3 \rightarrow P_3, R_4 \rightarrow P_4 (the assignment edge R1→P1R_1 \rightarrow P_1 means resource R1R_1 is assigned to process P1P_1, and so on for others)
Claim edges: P1→R2,P2→R3,P3→R1,P2→R4,P4→R2P_1 \rightarrow R_2, P_2 \rightarrow R_3, P_3 \rightarrow R_1, P_2 \rightarrow R_4, P_4 \rightarrow R_2 (the claim edge P1→R2P_1 \rightarrow R_2 means process P1P_1 is waiting for resource R2R_2, and so on for others)

Which of the following statement(s) is/are CORRECT?
More than one option can be correct.
Show answer without attempting

Answer: C, D

Q58

GATE CS 2025 CS-2Memory ManagementNAT2 marks
A computer system supports a logical address space of 2322^{32} bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a bb-bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.

The value of bb is ___________ . (Answer in integer)
Show answer without attempting

Answer: 11

0/200 correct0 marks

Related topics in GATE CS