1
GATE CSE 2025 Set 1
MCQ (Single Correct Answer)
+2
-0

A computer has two processors, $M_1$ and $M_2$. Four processes $P_1, P_2, P_3, P_4$ with CPU bursts of $20,16,25$, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:

$\bullet$ $M_1$ uses priority of execution for the processes as, $P_1>P_3>P_2>P_4$, i.e., $P_1$ and $P_4$ have highest and lowest priorities, respectively.

$\bullet$ $M_2$ uses priority of execution for the processes as, $P_2>P_3>P_4>P_1$, i.e., $P_2$ and $P_1$ have highest and lowest priorities, respectively.

A process $P_i$ is scheduled to a processor $M_k$, if the processor is free and no other process $P_j$ is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?

A
9.00
B
8.75
C
6.50
D
7.50
2
GATE CSE 2025 Set 1
Numerical
+2
-0

In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal page replacement algorithm is as follows:

The OS correctly predicts only up to next 4 page references (including the current page) at the time of allocating a frame to a page.

A process accesses the pages in the following order of page numbers:

$$1,3,2,4,2,3,1,2,4,3,1,4$$

If the system has three memory frames that are initially empty, the number of page faults that will occur during execution of the process is __________ (Answer in integer)

Your input ____
3
GATE CSE 2025 Set 1
Numerical
+1
-0
 #include < stdio.h>
void foo(int *p, int x) {
    *p = x;
}
int main( ) {
    int *z;
    int a = 20, b=25;
    z = &a;
    foo(z, b);
    printf("%d", a);
    return 0;
}

The output of the given C program is _________. (Answer in integer)

Your input ____
4
GATE CSE 2025 Set 1
Numerical
+2
-0
#include <stdio.h>
int foo(int S[ ], int size) {
    if(size == 0) return 0;
    if(size == 1) return 1;
    if(S[0]!=S[1]) return 1 + foo(S + 1, size - 1);
    return foo(S + 1, size - 1);
}
int main( ) {
    int A[] ={0,1,2,2,2,0,0,1,1};
    printf("%d", foo(A, 9));
    return 0;
}

The value printed by the given C program is _________. (Answer in integer)

Your input ____
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