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)
#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)
#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)
Consider the following C program :
#include < stdio.h>
int gate (int n) {
int d, t, newnum, turn;
newnum = turn = 0; t=1;
while (n>= t) t*= 10;
t/=10;
while (t>0) {
d=n/t;
n=n%t;
t/= 10;
if (turn) newnum = 10*newnum + d;
turn = (turn + 1) % 2;
}
return newnum;
}
int main( ) {
printf("%d", gate(14362));
return 0;
}
The value printed by the given C program is _________. (Answer in integer)