Instruction
- Total number of questions : 20
- Time allotted : 30:00 Minutes:Seconds.
- Each question carry 1 mark, no negative marks.
- DO NOT refresh the page.
- All the best
Operating Systems [ Question No: 1 To 20 ] :
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) mod 4]);
.......................
release (m[i]); release (m[(i+1) mod 4]);
This could be :
Consider a disk queue with request for input/output to block on cylinders 98, 183, 37, 122, 14, 124, 65 and 67 in that order. Assume that the disk head is initially positioned at cylinder 53 and moving towards cylinder O. The total number of head movements using Shortest Seek Time First (SSTF) and SCAN algorithms are respectively :
Suppose that the number of instructions executed between page fault is directly proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean interval between page faults is also doubled. Further, consider that a normal instruction takes one microsecond, but if a page fault occurs, it takes 2001 microseconds. If a program takes 60 sec. to run, during which time it gets 15,000 page faults, how long would it take to run if twice as much memory were available ?
Which of the following algorithms may cause starvation ?
(i) First-come-first-serve
(ii) Round Robin
(iii) Priority
(iv) Shortest process next
(v) Shortest remaining time first
An operating system (OS) crashes on the average once in 30 days, that is , the Mean Time Between Failures (MTBF) = 30 days. When this happens, it takes 10 minutes to recover the OS, that is, the Mean Time To Repair (MTTR) = 10 minutes. The availability of the OS with these reliability figures is approximately :

C : Computer System
T : Dumb Terminal
The given diagram most appropriately represents which of the following scenario ?
The link system call in UNIX is called link (sfname tfname) :
Which of the following statements are true ?
(1) sfname and tfname have the same inode after the call.
(2) sfname and tfname have the same directory entry after the call.
(3) sfname is an existing file before the call.
(4) tfname is an existing file before the call.
On termination which of the following system call does not return control to calling point :
................. is the MS-DOS command, counterpart to 'tar' of unix.
Which option is used for ignoring case during pattern search in grep command ?
The size of the swap space is decided :
Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is \(M\) units if the corresponding memory page is available in memory, and \(D\) units if the memory access causes a page fault. It has been experimentally measured that the average time taken for a memory access in the process is \(X\) units.
Which one of the following is the correct expression for the page fault rate experienced by the process?
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?
Consider the two functions incr and decr shown below.
incr(){
wait(s);
X = X+1;
signal(s);
}
decr(){
wait(s);
X = X-1;
signal(s);
}
There are 5 threads each invoking incr once, and 3 threads each invoking decr once, on the same shared variable X. The initial value of X is 10.
Suppose there are two implementations of the semaphore s, as follows:
I-1: s is a binary semaphore initialized to 1.
I-2: s is a counting semaphore initialized to 2.
Let V1, V2 be the values of X at the end of execution of all the threads with implementations I-1, I-2, respectively.
Which one of the following choices corresponds to the minimum possible values of V1, V2, respectively?
Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.
| T1 | T2 | T3 |
|---|---|---|
| while(true){ wait(S3); print("C"); signal(S2); } | while(true){ wait(S1); print("B"); signal(S3); } | while(true){ wait(S2); print("A"); signal(S1); } |
Which initialization of the semaphores would print the sequence BCABCABCA....?
Consider the following two-process synchronization solution.
Process 0
---------
Entry: loop while (turn == 1);
(critical section)
Exit: turn = 1;
Process 1
----------
Entry: loop while (turn == 0);
(critical section)
Exit: turn = 0;The shared variable turn is initialized to zero. Which one of the following is TRUE?
Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially a = b = 1. Though context switching between threads can happen at any time, each statement of T1 or T2 is executed atomically without interruption.
T1:a = a + 1;
b = b + 1;
T2:b = 2 * b;
a = 2 * a;
Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?
Which of the following is NOT a system call category?
Which of the following is NOT an input/output redirection symbol that Linux shell assigns?
Total number of questions : 20
Number of answered questions : 0
Number of unanswered questions : 20
Operating Systems [ Question No: 1 To 20 ] :
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) mod 4]);
.......................
release (m[i]); release (m[(i+1) mod 4]);
This could be :
Your Answer : (Not Answered)
Correct Answer : B
This could lead to Deadlock.
Process P[i] locks m[i] and then m[(i+1) mod 4]. For P[0] to P[3] this gives a circular chain: P[0] holds m[0] and wants m[1], P[1] holds m[1] and wants m[2], P[2] holds m[2] and wants m[3], and P[3] holds m[3] and wants m[0]. If all four acquire their first mutex before any gets its second, each waits for the next forever: hold-and-wait with circular wait, a deadlock.
Thrashing is excessive paging and has nothing to do with mutexes, and since a deadlock is possible, 'starvation but not deadlock' and 'none of the above' are wrong.
Consider a disk queue with request for input/output to block on cylinders 98, 183, 37, 122, 14, 124, 65 and 67 in that order. Assume that the disk head is initially positioned at cylinder 53 and moving towards cylinder O. The total number of head movements using Shortest Seek Time First (SSTF) and SCAN algorithms are respectively :
Your Answer : (Not Answered)
Correct Answer : D
The totals are 236 and 236 cylinders.
SSTF always serves the nearest pending request. From 53 the order is 65, 67, 37, 14, 98, 122, 124, 183:
12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236 cylinders.
SCAN moves towards cylinder 0 first, serving 37 and 14 on the way, reaches 0, then reverses and sweeps up to the last request, 183:
(53 - 0) + (183 - 0) = 53 + 183 = 236 cylinders.
640 is the first-come-first-served total for this queue, and 252 is not produced by either algorithm here, so the other options mix in the wrong figures.
Suppose that the number of instructions executed between page fault is directly proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean interval between page faults is also doubled. Further, consider that a normal instruction takes one microsecond, but if a page fault occurs, it takes 2001 microseconds. If a program takes 60 sec. to run, during which time it gets 15,000 page faults, how long would it take to run if twice as much memory were available ?
Your Answer : (Not Answered)
Correct Answer : C
The program would take 45 sec.
Each page fault costs 2001 microseconds instead of 1, so it adds 2000 microseconds over a normal instruction.
\[ \begin{aligned} \text{fault time} &= 15000 \times 2000\ \mu s = 30\ s \\ \text{normal time} &= 60 - 30 = 30\ s \end{aligned} \]
With twice the memory, the interval between faults doubles, so the number of faults halves to 7,500, while the normal execution time is unchanged:
\[ \begin{aligned} \text{new time} &= 30 + 7500 \times 2000\ \mu s \\ &= 30 + 15 = 45\ s \end{aligned} \]
30 seconds would be halving the whole run time, wrongly treating the normal instructions as reduced too, and 60 seconds ignores the saving.
Which of the following algorithms may cause starvation ?
(i) First-come-first-serve
(ii) Round Robin
(iii) Priority
(iv) Shortest process next
(v) Shortest remaining time first
Your Answer : (Not Answered)
Correct Answer : B
Starvation can occur with (iii), (iv) and (v).
Under priority scheduling, a low-priority process can wait indefinitely if higher-priority processes keep arriving. Shortest process next and shortest remaining time first always favour short jobs, so a long process can be postponed forever if short jobs keep coming.
First-come-first-served and round robin cannot starve a process. FCFS serves every process in arrival order, and round robin gives each ready process a time slice in turn, so every process eventually runs. Options including (i) or (ii) are therefore wrong.
An operating system (OS) crashes on the average once in 30 days, that is , the Mean Time Between Failures (MTBF) = 30 days. When this happens, it takes 10 minutes to recover the OS, that is, the Mean Time To Repair (MTTR) = 10 minutes. The availability of the OS with these reliability figures is approximately :
Your Answer : (Not Answered)
Correct Answer : D
The availability is approximately 99.97%.
Availability is the fraction of time the system is up:
\[ \begin{aligned} A &= \frac{MTBF}{MTBF + MTTR} \\ &= \frac{43200}{43200 + 10} \\ &= 0.99977 \approx 99.97\% \end{aligned} \]
Here 30 days = 30 × 24 × 60 = 43,200 minutes, so both times are in minutes. The other options are far too low: 96.97% would mean about 22 hours of downtime a month, not 10 minutes.

C : Computer System
T : Dumb Terminal
The given diagram most appropriately represents which of the following scenario ?
Your Answer : (Not Answered)
Correct Answer : A
The diagram represents a Centralized system.
All the processing is done by one computer system, C, and the dumb terminals, T, have no processing power of their own. They only send keystrokes to the central computer and display what it returns. A single computer serving many terminals is the classic centralized (time-sharing mainframe) arrangement.
A distributed system would need several computers, each with its own processing, cooperating over a network. Local-access and remote-access describe how a user reaches a computer, not the architecture shown, in which everything depends on the one central system.
The link system call in UNIX is called link (sfname tfname) :
Which of the following statements are true ?
(1) sfname and tfname have the same inode after the call.
(2) sfname and tfname have the same directory entry after the call.
(3) sfname is an existing file before the call.
(4) tfname is an existing file before the call.
Your Answer : (Not Answered)
Correct Answer : A
The true statements are (1) and (3).
link(sfname, tfname) creates a new directory entry, tfname, pointing to the same inode as the existing file sfname, and increments the inode's link count. So after the call both names refer to the same inode (1), and sfname must already exist before the call (3).
Statement (2) is false: the call creates a second, separate directory entry, so the two names have different directory entries that share one inode. Statement (4) is false too: if tfname already exists the call fails, so any option containing (2) or (4) is wrong.
On termination which of the following system call does not return control to calling point :
Your Answer : (Not Answered)
Correct Answer : A
The call that does not return to the calling point is exec.
A successful exec replaces the calling process's program with a new one: the old code, data and stack are discarded, so there is nothing to return to and execution begins at the new program's entry point. exec returns only if it fails.
fork returns twice, once in the parent (with the child's process ID) and once in the child (with 0), and ioctl returns a status to its caller. longjmp is a library function, not a system call, and it jumps back to a point saved earlier by setjmp.
................. is the MS-DOS command, counterpart to 'tar' of unix.
Your Answer : (Not Answered)
Correct Answer : B
The MS-DOS counterpart of tar is backup.
Unix tar (tape archive) bundles files and directories into a single archive, traditionally for backup to tape. MS-DOS provided the BACKUP command (with RESTORE) to copy files and directory trees from a hard disk to backup media in a form that could later be restored.
DIR only lists directory contents, COPY copies individual files without creating an archive, and EDIT is a text editor.
Which option is used for ignoring case during pattern search in grep command ?
Your Answer : (Not Answered)
Correct Answer : A
The option is -i.
grep -i pattern file ignores the difference between upper and lower case, so 'unix', 'Unix' and 'UNIX' all match.
-l lists only the names of the files containing a match, and -c prints the count of matching lines instead of the lines. -p is not a standard grep option.
The size of the swap space is decided :
Your Answer : (Not Answered)
Correct Answer : A
The size of the swap space is decided at the time of operating system installation.
Swap space is disk space set aside for pages or processes moved out of main memory. On most systems it is a separate disk partition or a preallocated swap file, created and sized when the disk is partitioned during installation of the operating system.
It is not fixed afresh at every start-up or when the swapper is loaded; those simply use the space already configured. The hardware does not decide it either, although the amount of physical memory guides the administrator's choice.
Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is \(M\) units if the corresponding memory page is available in memory, and \(D\) units if the memory access causes a page fault. It has been experimentally measured that the average time taken for a memory access in the process is \(X\) units.
Which one of the following is the correct expression for the page fault rate experienced by the process?
Your Answer : (Not Answered)
Correct Answer : B
The page fault rate is \((X - M) / (D - M)\).
If \(p\) is the page fault rate, a fraction \(p\) of accesses take \(D\) units and the rest take \(M\) units, so the measured average is
\[ \begin{aligned} X &= (1 - p)M + pD \\ X - M &= p(D - M) \\ p &= \frac{X - M}{D - M} \end{aligned} \]
Check: if no access faults, \(X = M\) and \(p = 0\); if every access faults, \(X = D\) and \(p = 1\). The option \((D - M)/(X - M)\) is the reciprocal and exceeds 1. \((D - X)/(D - M)\) is the hit rate \(1 - p\), and \((X - M)/(D - X)\) is the ratio of faults to hits.
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?
Your Answer : (Not Answered)
Correct Answer : A
The maximum number of page table entries is \(2^{21}\).
A single-level page table needs one entry for each page of the logical address space. The page size is \(2048 = 2^{11}\) bytes, so 11 of the 32 logical address bits are the offset within a page:
\[ \text{entries} = \frac{2^{32}}{2^{11}} = 2^{21} \]
The 20-bit physical address decides the number of frames, \(2^{20}/2^{11} = 2^{9}\), and the width of each entry, but not how many entries there are. \(2^{20}\) wrongly takes the physical address width, and \(2^{22}\) and \(2^{24}\) assume smaller pages.
Consider the two functions incr and decr shown below.
incr(){
wait(s);
X = X+1;
signal(s);
}
decr(){
wait(s);
X = X-1;
signal(s);
}
There are 5 threads each invoking incr once, and 3 threads each invoking decr once, on the same shared variable X. The initial value of X is 10.
Suppose there are two implementations of the semaphore s, as follows:
I-1: s is a binary semaphore initialized to 1.
I-2: s is a counting semaphore initialized to 2.
Let V1, V2 be the values of X at the end of execution of all the threads with implementations I-1, I-2, respectively.
Which one of the following choices corresponds to the minimum possible values of V1, V2, respectively?
Your Answer : (Not Answered)
Correct Answer : C
The minimum values are V1 = 12 and V2 = 7.
I-1. A binary semaphore initialised to 1 lets only one thread into the critical section at a time, so every update is applied in full and the result is the same in every run:
\[ V_{1} = 10 + 5 - 3 = 12 \]
I-2. A counting semaphore initialised to 2 lets two threads update X together, so one update can overwrite another (X = X+1 is a read, an add and a write). To make X as small as possible: a decr thread reads X = 10 and pauses inside. Meanwhile the five incr threads pass one by one through the second slot, raising X to 15. The paused decr then writes 9, wiping out all five increments. The other two decr threads run normally: 8, then 7.
No run can end below 7, because the three decrements can lower X by at most 3 from 10. So V2 = 7. 15 and 7 as V1 are impossible under mutual exclusion, and 8 is reachable but is not the minimum.
Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.
| T1 | T2 | T3 |
|---|---|---|
| while(true){ wait(S3); print("C"); signal(S2); } | while(true){ wait(S1); print("B"); signal(S3); } | while(true){ wait(S2); print("A"); signal(S1); } |
Which initialization of the semaphores would print the sequence BCABCABCA....?
Your Answer : (Not Answered)
Correct Answer : C
The initialization is \(S_{1} = 1;\ S_{2} = 0;\ S_{3} = 0\).
The sequence must start with B, so only T2, which waits on \(S_{1}\), may run first: \(S_{1} = 1\) and the others 0. Then T2 prints B and signals \(S_{3}\), which lets only T1 print C; T1 signals \(S_{2}\), which lets only T3 print A; T3 signals \(S_{1}\) and the cycle repeats. At every moment exactly one semaphore is 1, so the order BCA is forced.
In the other options more than one semaphore starts at 1. With \(S_{2} = 1\), T3 could print A first; with \(S_{3} = 1\), T1 could print C first; and option D, with \(S_{1} = 0\), cannot print B first at all.
Consider the following two-process synchronization solution.
Process 0
---------
Entry: loop while (turn == 1);
(critical section)
Exit: turn = 1;
Process 1
----------
Entry: loop while (turn == 0);
(critical section)
Exit: turn = 0;The shared variable turn is initialized to zero. Which one of the following is TRUE?
Your Answer : (Not Answered)
Correct Answer : C
The solution violates the progress requirement.
This is strict alternation. Mutual exclusion holds: turn is either 0 or 1, and each process can enter only when turn has its own value, so both can never be inside together. Bounded waiting also holds, because after a process leaves it hands the turn to the other, so neither can enter twice while the other waits.
Progress fails. Suppose Process 0 runs its critical section and sets turn = 1, and Process 1 has no wish to enter. If Process 0 now wants to enter again, it must wait for Process 1 to take its turn, which may never happen. A process outside its critical section is blocking another from entering, which is exactly what the progress requirement forbids.
Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially a = b = 1. Though context switching between threads can happen at any time, each statement of T1 or T2 is executed atomically without interruption.
T1:a = a + 1;
b = b + 1;
T2:b = 2 * b;
a = 2 * a;
Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?
Your Answer : (Not Answered)
Correct Answer : A
The possible results are (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3).
Each thread's two statements run in order, giving six interleavings. What matters is whether each update to a comes before or after the other thread's update to a, and the same for b:
- a: a + 1 then 2a gives 4; 2a then a + 1 gives 3.
- b: b + 1 then 2b gives 4; 2b then b + 1 gives 3.
T1 updates a before b and T2 updates b before a. If T1's a-update comes after T2's a-update, T2 has already finished, so T1's b-update is also last: (3, 3). Otherwise a = 4 and b can be either. So (4, 4), (4, 3) and (3, 3) occur, but (3, 4) cannot, which rules out options B and C. Values of 2 would require an update to be lost, impossible with atomic statements.
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?
Your Answer : (Not Answered)
Correct Answer : D
The burst times that are NOT possible are P = 3, Q = 7, R = 7, S = 3.
With a quantum of 4 and the order P, Q, R, S, these bursts run as P (3, done), Q (4, 3 left), R (4, 3 left), S (3, done), Q (3, done), R (3, done). The switches are P to Q, Q to R, R to S, S to Q and Q to R, so there is no switch from R to Q at all, against the 'exactly one' required.
Each of the other sets meets every condition. For P = 4, Q = 10, R = 6, S = 2 the run is P, Q, R, S, Q, R, Q, giving one S to Q, one R to Q, two Q to R and no S to P. P = 2, Q = 9, R = 5, S = 1 runs in the same order (P, Q, R, S, Q, R, Q), and so does P = 4, Q = 12, R = 5, S = 4, where R finishes its last unit before Q's final quantum. In each, Q still needs CPU time after R's second turn, which is what produces the single R to Q switch.
Which of the following is NOT a system call category?
Your Answer : (Not Answered)
Correct Answer : D
'Data Compilation' is not a system call category. The usual categories are process control, file manipulation, device manipulation, information maintenance and communication. Process control, device manipulation and file manipulation are named in the options, so the fourth option is the odd one out. The system calls of an operating system let programs request services such as creating a process, opening a file or reading from a device.
Which of the following is NOT an input/output redirection symbol that Linux shell assigns?
Your Answer : (Not Answered)
Correct Answer : D
The exclamation mark (!) is not an input/output redirection symbol. In the Linux shell the symbol < redirects standard input from a file, > redirects standard output to a file overwriting it, and >> appends the output to a file. The '!' is used for history expansion and for negation, not for redirecting input or output. For example, command > file.txt sends the output to a file, command < file.txt takes input from it, and command >> file.txt adds to it.
Marks
Total number of questions : 20
Number of answered questions : 0
Number of unanswered questions : 20