Professional Documents
Culture Documents
Gate Cse Practice Questions: of A Graph)
Gate Cse Practice Questions: of A Graph)
Gate Cse Practice Questions: of A Graph)
#include<stdio.h>
int *A, stkTop; int stkFunc(int opcode, int val)
{
static int size=0, stkTop=0;
switch (opcode) {
case -1: size = val;
break;
case 0: if(stkTop< size)A[stkTop++]= val;
break;
default: if (stkTop) returnA[--stkTop];
}
return -1;
}
int main()
{
int B[20]; A = B; stkTop =-1;
stkFunc (-1,10);
stkFunc ( 0,5);
stkFunc ( 0,10);
printf ("%d\n", stkFunc(1, 0) + stkFunc(1,0));
}
A. 5
B. 10
C. 15
D. 20
3. Considerthe alphabet ∑ = {0, 1}, the null/empty string λ and the sets of strings
X0, X1, and X2 generated by the corresponding non-terminals of a regular grammar.
X0, X1, and X2 are related as follows:
X0= 1
X1= 0 X1 + 1 X2
X2= 0 X1+ {λ}
Which one of the following choices precisely represents the strings in X0?
A. 10(0* + (10)*)1
B. 10(0* + (10)*)*1
C. 1(0 +10)*1
D. 10(0 + 10)*1 + 110(0 + 10)*1
GATE CSE PRACTICE QUESTIONS
A. A multiple of 4
B. Even
C. Odd
D. Congruent to 0 mod 4, or, 1 mod 4.
5. Consider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB, 300 KB
and 250 KB, where KB refers to kilobyte. These partitions need to be allotted to four
processes of sizes 357 KB, 210 KB,468 KB and 491KB in that order.If the best fit
algorithm is used,which partitions are NOT allotted to any process?
Answers:
1. B
2. C
3. C
4. D
5. A
Note: CDC doesn’t hold any copyright for the questions shared for practice, it has
been taken from resources available on internet.