• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

50 Operating System MCQs with Answers

Question 1

Which statement is not correct about “init” process in Unix?
  • It is generally the parent of the login shell.
  • It has PID 1.
  • It is the first process in the system.
  • Init forks and execs a ‘getty’ process at every port connected to a terminal.

Question 2

What does the following command do? grep -vn “abc” x
  • It will print all of the lines in the file x that match the search string “abc”.
  • It will print all of the lines in file x that do not match the search string “abc”.
  • It will print the total number of lines in the file x that match the string “abc”.
  • It will print the specific line numbers of the file x in which there is a match for string “abc”.

Question 3

The Unix Kernel maintains two key data structures related to processes, the process table and the user structure. Which of the following information is not the part of user structure ?
  • File descriptor table
  • System call state
  • Scheduling parameters
  • Kernel stack

Question 4

A unix file may be of the type:
  • Regular file
  • Directory file
  • Device file
  • Any one of the above

Question 5

Which of the following UNIX command allows scheduling a program to be executed at the specifies time?
  • cron
  • nice
  • date and time
  • schedule

Question 6

In which of the following four necessary conditions for deadlock processes claim exclusive control of the resources they require?
  • no preemption
  • mutual exclusion
  • circular wait
  • hold and wait

Question 7

Consider a system having "n" resources of same type. These resources are shared by 3 processes, A, B, C. These have peak demands of 3, 4, and 6 respectively. For what value of "n" deadlock won\'t occur
  • 15
  • 9
  • 10
  • 11

Question 8

Consider the following process and resource requirement of each process.
                 Type 1        Type 2
Process         Used  Max      Used  Max
   P1            1     2         1    3
   P2            1     3         1    2
   P3            2     4         1    4 
Predict the state of this system, assuming that there are a total of 5 instances of resource type 1 and 4 instances of resource type 2.
  • Can go to safe or unsafe state based on sequence
  • Safe state
  • Unsafe state
  • Deadlock state

Question 9

Suppose n processes, P1, …. Pn share m identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process Pi is Si, where Si > 0. Which one of the following is a sufficient condition for ensuring that deadlock does not occur?
  • A
  • B
  • C
  • D

Question 10

Consider the following snapshot of a system running n processes. Process i is holding Xi instances of a resource R, 1 <= i <= n. currently, all instances of R are occupied. Further, for all i, process i has placed a request for an additional Yi instances while holding the Xi instances it already has. There are exactly two processes p and q such that Yp = Yq = 0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock?
  • min (Xp, Xq) < max (Yk) where k != p and k != q
  • Xp + Xq >= min (Yk) where k != p and k != q
  • max (Xp, Xq) > 1
  • min (Xp, Xq) > 1

There are 50 questions to complete.

Last Updated :
Take a part in the ongoing discussion