

MCQOPTIONS
Saved Bookmarks
This section includes 13 Mcqs, each offering curated multiple-choice questions to sharpen your Operating System knowledge and support exam preparation. Choose a topic below to get started.
1. |
A process executes the following segment of code:for(i=1;i<=n;i++) fork() :The number of new processes created is: |
A. | n |
B. | \(\frac{{{\rm{n}}\left( {{\rm{n}} + 1} \right)}}{2}\) |
C. | 2n – 1 |
D. | 3n – 1 |
Answer» D. 3n – 1 | |
2. |
Consider three CPU intensive processes, which require 10, 20, 30 units and arrive at times 0,2,6 respectively. How many context switches are needed if shortest remaining time first is implemented? Context switch at 0 is included but context switch at end is ignored |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» D. 4 | |
3. |
A thread is also called: |
A. | A virtual process |
B. | A lightweight process |
C. | A heavyweight process |
D. | A scheduler` |
Answer» C. A heavyweight process | |
4. |
Assuming that the system call fork () never fails, consider the following C programs P1 and P2 executed on a UNIX / Linux system:/*P1*/Int main() {fork ():fork () ;fork () ;Printf(“Happy\n”);}/*P2*/Int main() {fork ();Printf(“Happy\n”);fork ()Printf(“Happy\n”);fork () ;Printf(“Happy\n”);} Statement I: P1 displays "Happy" 8 times.Statement II: P2 displays "Happy" 12 times.In the light of the above statements, choose the correct answer from the options given below |
A. | Both Statement I and Statement II are true |
B. | Both Statement I and Statement II are false |
C. | Statement I is correct but Statement II is false |
D. | Statement I is incorrect but Statement II is true |
Answer» D. Statement I is incorrect but Statement II is true | |
5. |
Process is: |
A. | contents of main memory |
B. | a job secondary memory |
C. | a program in execution |
D. | program in High level language kept on disk |
Answer» D. program in High level language kept on disk | |
6. |
Dispatch latency is defined as |
A. | the speed of dispatching a process from running to the ready state |
B. | the time of dispatching a process from running to ready state and keeping the CPU idle |
C. | the time to stop one process and start running another one |
D. | none of these |
Answer» D. none of these | |
7. |
Consider the following statements about process state transitions for a system using preemptive scheduling.I. A running process can move to ready state.II. A ready process can move to running state.III. A blocked process can move to running state.IV. A blocked process can move to ready state.Which of the above statements are TRUE? |
A. | I, II, and III only |
B. | II and III only |
C. | I, II, and IV only |
D. | I, II, III, and IV |
Answer» D. I, II, III, and IV | |
8. |
Copying a process from memory to disk to allow space for other processes is called _________. |
A. | Deadlock |
B. | Swapping |
C. | Page fault |
D. | Demand paging |
Answer» C. Page fault | |
9. |
In which of the following state, the process is waiting for processor ? |
A. | New |
B. | Waiting |
C. | Ready |
D. | Running |
Answer» D. Running | |
10. |
A process execute the following code:For (I = 1; I ≤ n; I ++) fork ();How many child processes are created? |
A. | n - 1 |
B. | 2n - 1 |
C. | 2n-1 |
D. | 2n-1 -1 |
Answer» C. 2n-1 | |
11. |
A process waiting to be assigned to a processor is considered to be in ___ state. |
A. | waiting |
B. | ready |
C. | terminated |
D. | running |
Answer» C. terminated | |
12. |
Consider the following multi-threaded code segment (in a mix of C and pseudocode), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:int x = 0; // globalLock L1; // globalmain() {create a thread to execute foo(); // Thread T1create a thread to execute foo(); // Thread T2wait for the two threads to finish execution;print (x);}foo() {int y = 0;Acquire L1;x = x + 1;y = y + 1;Release L1;print (y); }Which of the following statement(s) is/are correct ? |
A. | Both T1 and T2, in both the processes, will print the value of y as 1. |
B. | At least one of P1 and P2 will print the value of x as 4 |
C. | Both P1 and P2 will print the value of x as 2. |
D. | At least one of the threads will print the value of y as 2. |
Answer» B. At least one of P1 and P2 will print the value of x as 4 | |
13. |
A process executes the following codefor (i = 0; i < n; i ++) fork( );The total number of child processes created is |
A. | n2 |
B. | 2n+1 - 1 |
C. | 2n |
D. | 2n -1 |
Answer» E. | |