1
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
A uni-processor computer system only has two processes, both of which alternate $$10$$ $$ms$$ $$CPU$$ bursts with $$90$$ $$ms$$ $${\rm I}/O$$ bursts. Both the processes were created at nearly the same time. The $${\rm I}/O$$ of both processes can proceed in parallel. Which of the following scheduling strategies will result in the least $$CPU$$ utilization (over a long period of time) for this system?
A
First come First served scheduling
B
Shortest remaining time first scheduling
C
Static priority scheduling with different priorities for the two processes
D
Round robin scheduling with a time quantum of $$5$$ $$ms.$$
2
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.

Process P:

while(1){
  W:
  Print '0';
  Print '0';
  X:
}

Process Q:

while(1){
  Y:
  Print '1';
  Print '1';
  Z:
}
Synchronization statements can be inserted only at points W, X, Y, and Z.

Which of the following will ensure that the output string never contains a substring of the form 01n0 or 10n1 where n is odd?

A
P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1
B
P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1
C
P(S) at W, V(S) at X, P(S) at Y, V(S) at Z, S initially 1
D
V(S) at W, V(T) at X, P(S) at Y, P(T) at Z, S and T initially 1
3
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.

Process P:

while(1){
  W:
  Print '0';
  Print '0';
  X:
}

Process Q:

while(1){
  Y:
  Print '1';
  Print '1';
  Z:
}
Synchronization statements can be inserted only at points W, X, Y, and Z.

Which of the following will always lead to an output starting with 001100110011

A
P(A) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1
B
P(A) at W, V(T) at X, P(T) at Y, V(S) at Z, S initially 1 and T initially 0
C
P(S) at W, V(T) at X, P(T) at Y,V(T) at Z, S and T initially 1
D
P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S initially 1 and T initially 0
4
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
Consider the C program shown below.
#include < stdio.h >
#define print(x) printf("%d ", x)
int x;
void Q(int z) {
   z += x; print(z);
}
void P(int *y) {
   int x = *y+2;
   Q(x); *y = x-1;
   print(x);
}
main(void) {
   x = 5;
   P(&x);
   print(x);
}
The output of this program is
A
12 7 6
B
22 12 11
C
14 6 6
D
7 6 6
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12