0% found this document useful (0 votes)
1K views11 pages

Operating System Gate Questions

Uploaded by

vimalvr.sse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views11 pages

Operating System Gate Questions

Uploaded by

vimalvr.sse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

OPERATING SYSTEM GATE QUESTIONS

Process Concepts and CPU Scheduling


1) Which scheduling policy is most suitable for a time-shared operating systems?
a) Shortest Job First
b) Round Robin
c) First come First serve
d) Elevator
Answer: Round Robin

2) The process state transition diagram in Figure is representative of

a) A batch operating system


b) An operating system with a non-preemptive scheduler
c) An operating system with a preemptive scheduler
d) A uni-programmed operating system
Answer: An operating system with a preemptive scheduler

3) Which of the following is an example of spooled device?


a) A line printer used to print the output of number of jobs.
b) A terminal used to enter input data to a running program.
c) A secondary storage device in a virtual memory system
d) A graphic display device
Answer: A line printer used to print the output of number of jobs.

4) Which of the following is an example of spooled device?


a) The terminal used to enter the input data for the C program being executed.
b) An output device used to print the output of a number of jobs.
c) The secondary memory device in a virtual storage system.
d) The swapping area on a disk used by the swapper.
Answer: An output device used to print the output of a number of jobs.
5) Consider nn processes sharing the CPUCPU in a round-robin fashion. Assuming that each
process switch takes ss seconds, what must be the quantum size qq such that the overhead
resulting from process switching is minimized but, at the same time each process is
guaranteed to get its turn at the CPUCPU at least every tt seconds?

Answer:

6) System calls are usually invoked by using:


a) A software interrupt
b) Polling
c) An indirect jump
d) A privileged instruction
Answer: A software interrupt

7) A processor needs software interrupt to


a) Test the interrupt system of the processor
b) Implement co-routines
c) Obtain system services which need execution of privileged instructions
d) Return from subroutine
Answer: Obtain system services which need execution of privileged instructions.

8) Consider a set of nn tasks with known runtimes r1,r2,.....rnr1,r2,.....rn to be run on a


uniprocessor machine. Which of the following processor scheduling algorithms will result
in the maximum throughput?
a) Round-Robin
b) Shortest -Job- First
c) Highest-Response-Ratio-Next
d) First-Come-First-Served
Answer: Shortest -Job- First

9) The maximum number of processes that can be in Ready state for a computer system with
n CPUs is :
a) n
b) n2
c) 2n
d) Independent of n

Answer: d

10) Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths
submitted at the same time to a computer system. Which one of the following process
scheduling algorithms would minimize the average waiting time in the ready queue?

(A) Shortest remaining time first


(B) Round-robin with time quantum less than the shortest CPU burst
(C) Uniform random
(D) Highest priority first with priority proportional to CPU burst length

Answer: (A)
11) The following C program is executed on a Unix / Linux system:
#include <unistd.h>
int main() {
int i;
for (i = 0; i < 10; i++)
if (i % 2 == 0) fork();
return 0;
}
The total number of child process created is __________ .

Note – This was Numerical Type question.

(A) 31
(B) 63
(C) 5
(D) 6
Answer: (A)
Synchronization and Concurrency
1 mark:
1. critical section is a program segment
(A) which should run in a certain specified amount of time
(B) which avoids deadlocks
(C) where shared resources are accessed
(D) which must be enclosed by a pair of semaphore operations, P and V
Answer: (C)

2. What is said to happen when the result of computation depends on the speed of the
processes involved?
a. A deadlock
b. A time lock
c. Cycle stealing
d. Race condition
Answer: Race condition

3. Let m[0]…m[4] be mutexes (binary semaphores) and P[0] …. P[4] be processes.


Suppose each process P[i] executes the following:

wait (m[i]); wait(m[(i+1) mode 4]);

------

release (m[i]); release (m[(i+1)mod 4]);


This could cause:
(A) Thrashing
(B) Deadlock
(C) Starvation, but not deadlock
(D) None of the above
Answer: (B)

4. A counting semaphore was initialized to 10. Then 6P (wait) operations and 4V


(signal) operations were completed on this semaphore. The resulting value of the
semaphore is

0
8
10
12
Answer: (B)

5. Where does the swap space reside?


(a) RAM
(b) Disk
(c) ROM
(d) On-chip cache
Answer: (b)

6. Suppose a processor does not have any stack pointer register. Which of the
following statements is true?
(A) It cannot have subroutine call instruction
(B) It can have subroutine call instruction, but no nested subroutine calls
(C) Nested subroutine calls are possible, but interrupts are not
(D) All sequences of subroutine calls and also interrupts are possible
Answer: (A)

7. Which of the following scheduling algorithms is non-preemptive?


(A) Round Robin
(B) First-In First-Out
(C) Multilevel Queue Scheduling
(D) Multilevel Queue Scheduling with Feedback
Answer: (B)

8. Consider the methods used by processes P1 and P2 for accessing their critical
sections whenever needed, as given below. The initial values of shared boolean
variables S1 and S2 are randomly assigned.

Method Used by P1
while (S1 == S2) ;
Critica1 Section
S1 = S2;

Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1);
Which one of the following statements describes the properties achieved?
(A) Mutual exclusion but not progress
(B) Progress but not mutual exclusion
(C) Neither mutual exclusion nor progress
(D) Both mutual exclusion and progress

Answer: (A)

9. Three concurrent processes X, Y, and Z execute three different code segments that
access and update certain shared variables. Process X executes the P operation (i.e.,
wait) on semaphores a, b and c; process Y executes the P operation on semaphores b,
c and d; process Z executes the P operation on semaphores c, d, and a before entering
the respective code segments. After completing the execution of its code segment,
each process invokes the V operation (i.e., signal) on its three semaphores. All
semaphores are binary semaphores initialized to one. Which one of the following
represents a deadlock-free order of invoking the P operations by the processes?
(A) X: P(a)P(b)P(c) Y: P(b)P(c)P(d) Z: P(c)P(d)P(a)
(B) X: P(b)P(a)P(c) Y: P(b)P(c)P(d) Z: P(a)P(c)P(d)
(C) X: P(b)P(a)P(c) Y: P(c)P(b)P(d) Z: P(a)P(c)P(d)
(D) X: P(a)P(b)P(c) Y: P(c)P(b)P(d) Z: P(c)P(d)P(a)

Answer: (B)

10. A file is organized so that the ordering of data records is the same as or close to
the ordering of data entries in some index. Then that index is called
(A) Dense
(B) Sparse
(C) Clustered
(D) Unclustered

Answer: (C)

11. The following two functions P1 and P2 that share a variable B with an initial
value of 2 execute concurrently.

P1()
{
C = B – 1;
B = 2*C;
}

P2()
{
D = 2 * B;
B = D - 1;
}
The number of distinct values that B can possibly take after the execution is
(A) 3
(B) 2
(C) 5
(D) 4

Answer: (A)
Deadlocks
1. A computer has six tape drives, with n processes competing for them. Each process
may need two drives. What is the maximum value of n for the system to be deadlock
free? Ans: 5
2. A system has 6 identical resources and N processes competing for them. Each
process can request atmost 2 resources. Which one of the following values of N could
lead to a deadlock? Ans: 6
3. Consider a system with 3 processes that share 4 instances of the same resource
type. Each process can request a maximum of K instances. Resource instances can be
requested and released only one at a time. The largest value of K that will always
avoid deadlock is ____. Ans: 2

Memory Management
1. Which page replacement policy sometimes leads to more page faults when size of
memory is increased? Ans: FIFO
2. In a paged segmented scheme of memory management, the segment table itself
must have a page table because: Ans: The segment table is too large to fit in one
page
3. The principle of locality justifies the use of Ans: Cachememory
4. A linker is given object modules for a set of programs that were compiled
separately. What information need to be included in an object module? Ans: Absolute
address of internal symbols
5. A ROM is sued to store the table for multiplication of two 88-bit unsigned integers.
The size of ROM required is Ans: 64K *16
6. Locality of reference implies that the page reference being made by a process
Ans: Is likely to be to one of the pages used in the last few page references
7. Thrashing
Ans: Implies excessive page I/O
8. Dirty bit for a page in a page table
Ans: Helps avoid unnecessary writes on a paging device
9. In a resident –OS computer, which of the following systems must reside in the
main memory under all situations? Ans: Loader
10.Which of the following statements is false?
Ans: Virtual memory implements the translation of a program’s address space into
physical memory address space.

11. The process of assigning load addresses to the various parts of the program and
adjusting the code and date in the program to reflect the assigned addresses is called
Ans: Relocation

12. Consider a virtual memory system with FIFOFIFO page replacement policy. For
an arbitrary page access pattern, increasing the number of page frames in main
memory will Ans: sometimes increase the number of page faults
13. Which of the following is not a form of memory?
Ans: Instruction opcode
14. The optimal page replacement algorithm will select the page that.
Ans: Will not be used for the longest time in the future.

15. In a system with 32 bit virtual addresses and 11 KB page size, use of one-level
page tables for virtual to physical address translation is not practical because of
Ans: The large memory overhead in maintaining page tables.

16. Consider a program P that consists of two source modules M1 and M2 contained
in two different files. If M1 contains a reference to a function defined in M2, the
reference will be resolved at.
Ans: Link-time

17. Which of the following addressing modes are suitable for program relocation at
run time?
1. Absolute addressing
2. Based addressing
3. Relative addressing
4. Indirect addressing
Ans: 2 and 3

18. The minimum number of page frames that must be allocated to a running process
in a virtual memory environment is determined by.
Ans: the instruction set architecture

19.What is the swap space in the disk used for?


Ans: Saving process data

20. In which one of the following page replacement policies, Belady’s anomaly may
occur?
Ans: FIFO

21. The essential content(s) in each entry of a page table is / are:


Ans: Page frame number.

22. How many 32K×1RAM chips are needed to provide a memory capacity of 256 K-
bytes?
Ans: 64

23. A system uses FIFO policy for page replacement. It has 4 pages frames with no
pages loaded to begin with. The system first accesses 100 distinct pages in some order
and then accesses the same 100pages but now in the reverse order. How many page
faults will occur?
Ans: 196

24. A system uses 3 page frames for storing process pages in main memory. It uses
the Least Recently Used (LRU) page replacement policy. Assume that all the page
frames are initially empty. What is the total number of page faults that will occur
while processing the page reference string given below?4,7,6,1,7,6,1,2,7,2
Ans: 6
25. Consider a system with byte-addressable memory, 32-bit logical addresses, 4
kilobyte page size and page table entries of 4 bytes each. The size of the page table in
the system in megabytes is ________.
Ans: 4

26. A computer system implements a 40-bit virtual address, page size of 8 kilobytes,
and a 128-entry translation look-aside buffer (TLB) organized into 32 sets each
having four ways. Assume that the TLB tag does not store any process id. The
minimum length of the TLBtag in bits is ________________.
Ans: 22

27. In which one of the following page replacement algorithms it is possible for the
page fault rate to increase even when the number of allocated frames increases?
Ans: FIFO

28.Consider allocation of memory to a new process. Assume that none of the existing
holes in the memory will exactly fit the process's memory requirement. Hence, a new
hole of smaller size will be created if allocation is made in any of the existing holes.
Which one of the following statements is TRUE?
Ans: The hole created by best fit is never larger than the hole created by first fit.

File System IO and Protection


1. I/O redirection
Ans: Can be employed to use an existing file as input file for a program

2. The correct matching for the following pairs is


List - II
(a) DMADMA I/OI/O
(b) Cache
(c) Interrupt I/OI/O
(d) Condition Code Register
List - IIII
(1) High speed RAMRAM
(2) Disk
(3) Printer
(4) ALUALU
Ans: a−2,b−1,c−3,d−4

3. When an interrupt occurs, an Operating System


Ans: Always resumes execution of interrupted process after processing the interrupt

4. The correct matching for the following pairs is


(a) Disk scheduling (1) Round robin
(b) Batch processing (2) SCAN
(c) Time sharing (3) LIFO
(d) Interrupt processing (4) FIFO
Ans: a−2,b−4,c−1,d−3

5. Which of the following devices should get higher priority in assigning interrupts?
Ans: keyboard

6. Which of the following is true?


Ans: A processor checks for interrupts before executing a new instruction.

7. Listed below are some operating system abstractions (in the left column) and the
hardware components. Which matching pairs is correct?
List-II
(a) Thread (b) Virtual Address space
(c) File System (d) Signal
List-IIII
(1) Interrupt (2) Memory
(3) CPUCPU (4) Disk
Ans: a−3,b−2,c−4,d−1

8. Which of the following disk scheduling strategies is likely to give the best
throughput?
Ans: Nearest cylinder next

9. Which of the following requires a device driver?


Ans: disk

10. Using a larger block size in a fixed block size file system leads to
Ans: better disk throughput but poorer disk space utilization

11. Consider an operating system capable of loading and executing a single sequential
user process at a time. The disk head scheduling algorithm used is First Come First
Served (FCFS). If FCFS is replaced by Shortest Seek Time First (SSTF), claimed by
the vendor to give 50%better benchmark results, what is the expected improvement in
the I/O performance of user programs?
Ans: 0%

12. Normally user programs are prevented from handling I/O directly by I/O
instructions in the for CPU having explicit I/O instructions, such I/O protection is
ensured by having the I/O instructions privilege in CPU with memory mapped I/O
there is no explicit I/O instruction. Which one of the following is true for a CPU with
memory mapped I/O?
Ans: I/O protection ensured by operating system routines(s)
13. Consider a disk pack with 16 surfaces, 128 tracks per surface and 256 sectors per
track. 512 bytes of data are stored in a bit serial manner in a sector. The capacity of
the disk pack and the number of bits required to specify a particular sector in the disk
are respectively: A
Ans: 256 Mbytes, 19 bits

14.The data blocks of a very large file in the Unix file system are allocated using
Ans: an extension of indexed allocation.

15. Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the disk
arm is at cylinder 100, and there is a queue of disk access requests for cylinders 30,
85, 90, 100, 105, 110, 135 and 145. If Shortest-Seek Time First (SSTF) is being used
for scheduling the disk access, the request for cylinder 90 is serviced after servicing
____________ number of requests.
Correct Answer is 3

16. A FAT (file allocation table) based file system is being used and the total
overhead of each entry in the FAT is 4 bytes in size. Given a 100×10^6bytes disk on
which the file system is stored and data block size is 10^3 bytes, the maximum size of
a file that can be stored on this disk in units of 10^6106 bytes is __________.
Correct Answer is 99.6

You might also like