GATE 2022 Paper Solution (CS) IESMaster
GATE 2022 Paper Solution (CS) IESMaster
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Using above information we can draw, dots in the below figure. Two ropes, R1 and R2,
P/U are already present and cannot be moved.
What is the least number of additional straight
ropes needed to create the desired plots ? A
single rope can pass through three poles that
R S/Q
are aligned in a straight line.
U/P T R2
Q/S
S can’t be place at a corners because PR is
parallel with QS.
Option (c) is correct.
R1
5. A box contains five balls of same size and shape.
Three of them are green coloured balls and two
of them are orange coloured balls. Balls are (a) 2 (b) 3
drawn from the box one at a time. If a green (c) 4 (d) 5
ball is drawn, it is not replaced. If an orange
ball is drawn, it is replaced with another orange Sol: (b)
ball.
First ball is drawn. What is the probability of R2
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Sol: (a) (d) Equal number of boys and girls qualified.
Sol: (b)
3
Let total candidates appeared = x
2
Appeared boys = 65%x = 0.65x
1 Appeared girls = 35%x = 0.35x
x Let total qualified = y
0 1/3 3/4 1
qualified boys = 40%y = 0.4y
1 3 1 3
Area = 2 × + 3 × – +1 × 1 – qualified girls = 0.6%y = 0.6y
3 4 3 4
2 5 1 Option (b) is correct because 0.6y > 0.4y.
= + 3 × +1 ×
3 12 4 Option (b) is correct.
2 15 1 8 +15 + 3 26 13 9. The ______ is too high for it to be considered
+ + =
= = =
3 12 4 12 12 6 _____.
Another Solution : (a) fair/fare (b) fare/fair
1 (c) fare /fare (d) faer /fair
2 if 0 x 2
Sol: (b)
1 3
y(x) = 3 if 3 x 4
The fare is too high for it to be considered fair.
3
1 if x 1 10. Given below are four statements.
4
1 Statement 1 : All students are inquisitive
Area = y x dx Statement 2 : Some students are inquisitive
0 Statement 3 : No student in inquisitive
1/3 3/4 1 Statement 4 : Some students are not inquisitive
2dx + 3dx + 1dx
0 1/3 3/4
From the given four statements, find the two
statemen ts th at CANNOT BE TRUE
1/3 3/4 1
2 x 0 + 3 x 1/3 + x 3/4 simultaneously, assuming that there is at least
one student in the class.
2 3 1 1
+ 3 – + (a) Statement 1 and Statement 3
3 4 3 4
(b) Statement 3 and Statement 4
8 +15 + 3 26 13
= = (c) Statement 1 and Statement 2
12 12 6
(d) Statement 2 and Statement 4
8. In a recently conducted national entrance test,
boys constituted 65% of those who appeared for Sol: (a)
the test. Girls constituted the remaining Inquisitive
candidates and they accounted for 60% of the
qualified candidates.
Which one of the following is the correct logical Students
inference based on the information provided in
the above passage ?
(a) The number of boys who appeared for the
1. All students are inquisitive.
test is less than the number of girls who
appeared Students Inquisitive
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
2. Some students are inquisitive. (ii) To shrink the cache to make available more
If all are true then some also true so first RAM for other users.
and second can be true simultaneously. (a) For read/write misses in write back, a line
Students Inquisitive needed to be evicted for the newly fetched
block. Hence, option (a) is false.
(b) In write back, dirty bit is set for those lines
which are updated.
In write through, no dirty bit is required.
3. No student is inquisitive. Hence option (b) is FALSE.
4. Some students are not acquisitive. (c) In write through, no need to do eviction of
Students a block from cache. So there is no data
Inquisitive
transfer required from cache to main
memory. Hence, option (c) is TRUE.
(d) In write back, data transfer from cache to
memory is required at the time of block
replacement, i.e. when eviction required.
If some students are in inquisitive true then
Hence, option (d) is FALSE.
some students are not inquisitive is also true.
Second and fourth can be true simultaneously. 12. In a relational data model, which one of the
So, option (a) is correct. following statements is TRUE ?
(a) A relation with only two attributes is always
TECHNICAL in BCNF.
(b) BCNF decomposition preserve functional
11. Let WB and WT be two sets associate cache dependencies.
organizations that use LRU algorithm for cache
(c) Every relation has at least one non-prime
block replacement. WB is a write back cache
attribute.
and WT is a write through cache. Which of the
following statements is FALSE ? (d) If all attributes of a relation are prime
attributes, then the relation is in BCNF.
(a) A read miss in WB will never lead to eviction
of a dirty block from WB. Sol: (a)
(b) Each cache block in WB and WT has a dirty At last one of the following holds in BCNF.
bit.
(i) is a trivial functional dependency i.e
(c) Eviction of a block from WT will not lead to .
data transfer from cache to main memory.
(ii) is a superkey.
(d) Every write hit in WB leads to a data
Thus, a relation with only two attribute must
transfer from cache to main memory.
be in BCNF.
Sol: (a, b, d)
BCNF decomposition doesn’t preserve functional
In write through policy, all the write operation dependencies.
is made in main memory and cache memory It is not mandatory that every relation has at
simultaneously, ensure that main memory is least one non-prime attribute.
valid.
If all attributes of relation are prime attribute,
In write back policy, at the time of block then the relation is always in 3NF.
replacement when dirty bit is set on the line
changes is written back into the memory. 13. Consider the following languages :
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Which of the following statements is/are 14. The value of the following limit is _____.
FALSE ?
x
(a) Neither L1 nor L2 is context-free. Lim
x 0+ 1 – e2 x
deterministic context-free.
Sol: (a, b, c) 0 0
put 0 in equation =
1 –1 0
Given languages,
Apply L' hospital rule, we get (differentiate
L1 = ww|w a,b * numerator and denominator)
L 2 = a n b nc m |m,n 0 1
2 x
L3 = a m bn cn |m,n 0 xLim
0 + 2
0 – e2 x.
L2 - Context free
L3 - Context free
x 1 + x2 + 1 + 1
x 3 – x2
(a) 2 1–x (b)
L 2 L3 = a n b nc n or a m b mc m |m,n 0
1 – x 2
1 – x 1 – x
2
2x 1 x 1
This language is context sensitive language. + +
2 1–x 2 1–x
(c) (d)
Option (b) is FALSE. 1 – x 2
1 – x 2
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Q1: 1 2 3 4
Q2 Q2 4 3 2 1
Head Head Head
Sol: (0) Q 2: 3 2 1
Given queues Q1 and Q2
Head
Head Step (4)
Q1 1 2 3 4 Q 1:
Q 2: 4 3 2 1
Q2
Head
Head
Thus, there are zero enque operation performed
Traverse head of Q2 at the end of queue so
on queue Q1.
Queue format becomes,
17. Consider a network with three routers P, Q, R
Head
shown in the figure below. All the links have
cost of unity.
Q1 1 2 3 4
P Q R
Q2
The routers exchange distance vector routing
information and have converged on the routing
Head tables, after which the link Q-R fails. Assume
that P and Q send out routing updates at
Now perform dequeue operation in Q1 at head random times, each at the same average rate.
position and performe enqueue operation in Q2 The probability of a routing loop formation
at head position.
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
(rounded off to one decimal place) between P Which initialization of the semaphores would
and Q, leading to count-to-infinity problem, is print the sequence BCABCA BCA .... ?
_________. (a) S1 = 1; S2 = 0; S3 = 0
Sol: (0.5) (b) S1 = 1; S2 = 1; S3 = 1
1 1 (c) S1 = 1; S2 = 1; S3 = 0
P Q R
(d) S1 = 0; S2 = 1; S3 = 1
R 2 Q R 1
Sol: (a)
When link between Q and R is broken.
Given threads are T1, T2 and T3 and three
1
P Q R binary semaphore variable is used for
synchronization S1, S2 and S3.
R 2 Q R
When Node P receives triggered update first T1 T2 T3
from node Q, then P successfully updated. while true { while true { while true {
1 wait S3 ; wait S1 ; wait S2 ;
P Q R
pr int "c " ; pr int "B" ; pr int " A " ;
R Q R
signal S2 ; signal S3 ; signal S1 ;
In this case no issue observed and count-infinity Given sequence need to print,
problem doesn’t arised.
BCABCABCA...
If node Q receives update first from node P.
First element in this sequence is ‘B’. It means
1 thread T2 should execute first.
P Q R
Thus, at this moment.
R 2 Q R
S1 = 1, S2 = 0, S3 = 0
1
P Q R 19. Consider a digital display system (DDS) shown
in the figure that displays the contents of register
R 2 Q R 3 P
X. A 16-bit code word is used to load a word in
So, routing table of Q is updated and it causes X, either from S or from R. S is a 1024-word
count-infinity problem. memory segment and R is a 32-word register
file. Based on the value of mode bit M, T selects
So, out of two node, one node is responsible for an input word to load in X. P and Q interface
count-to-infinity issue. with the corresponding bits in the code word to
So, the probability of a routing loop formation choose the addressed word. Which one of the
between P and Q is 0.5. following represents the functionality of P, Q,
and T ?
18. Consider the following threads, T1, T2 and T3
Code Word
executing on a single processor, synchronized
M S-address R-address
using three binary semaphore variables, S1, S2
and S3, operated upon using standard wait ( )
and signal ( ). The threads can be context P P
switched in any order and at any time.
S R
T1 T2 T3
while (true) { while (true) { while (true) {
wait (S3 ); wait (S1 ); wait (S2 ); T
print ("C") ; print ("B") ; print ("A ");
signal (S2 ); } signal (S3 ) ; } signal (S1 ); } X DDS
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
(a) P is 10:1 multiplexer; Q is 5:1 multiplexer; via three routers. Each interface of router formed
T is 2:1 multiplexer a subnet.
(b) P is 10:210 decoder; Q is 5:25 decoder; T is Firewal 4
R2
6
2:1 multiplexer. 5
2
(c) P is 10:210
decoder;Q is 5:25 decoder; T is R1
Web
R2 3
1 Ethernet
2:1 encoder Server
Ethernet
(d) P is 1:10 de-multiplexer; Q is 1:5 de- Subnet-2
multiplexer; T is 2:1 multiplexer
Sol: (b) Subnet-3
Subnet-1
Given digital display system, in which 16-bit
code word is used. Number of subnet = 6
Router Router
Time quanta = 4 time unit.
Web Server
All the processes arrives at time t = 0.
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
P Q R S Q R Q Let take I is a subgroup of G, if e, f I , we have
B. e, f G , then ef = fe. So, I is commutative.
0 2 6 10 11 15 16 17 (b) If the order of ‘G’ is 2 means it is order of
P Q R S Q R
prime, so ‘G’ is commutative.
C. (c) xy 2 = x 2 y 2
0 3 7 11 14 17 20
P Q R S Q R Q
xy xy = xx yy
D. Take x –1 and y –1 on both side.
0 4 8 12 14 18 20 22
x –1xy xy y –1 = x –1 xx yyy –1
In option (c) , there is no context switching
yx = xy, so it is commutative.
exist from R to Q.
(d) x G, x 2 = 1 then G is
22. Consider a relation R(A,B,C,D,E) with the xx = 1 x = x–1
following three functional dependencies. If every element has its own inverse in a
AB C; BC D; C E; graph, then graph is commutative.
The number of superkeys in the relation R is 24. Consider a simple undirected unweighted graph
__________. with at least three vertices. If A is the adjacency
Sol: (8) matrix of the graph, then the number of 3-
cycles in the graph is given by the trace of
Given three functional dependencies,
(a) A3 divided by 6 (b) A3
AB C
(c) A3 divided by 3 (d) A3 divided by 2
BC D
Sol: (a)
C E
All pair shortest paths for adjacency matrix =
Compute closure of attribute, n
A ij .
+
AB = A,B,C,D,E n
+
A ij = n vertices can walk from i – j.
BC = B,C,D,E
C+ = {C, E} Since, the cycle has 3 vertices and it is counted
for every vertex, we need to divide by 3. To get
Only one candidate key is possible for given
relation : {A B} A 3ij
the three vertex loop for directed graph = .
3
Superkey can be found by adding any combination
of attribute {C, D, E} with candidate key (AB). For undirected graph, A-B-C-A is same as A-C-
B-A cycle. So, 2 possibility will be formed.
Number of possible combination with candidate
key required = 23 = 8. The number of 3-cycle for undirected graph is
A 3ij
23. Which of the following statements is/are TRUE .
3*2
for a group G?
A 3ij
(a) If G is commutative, then a subgroup of G =
need not be commutative 6
(b) If the order of G is 2, then G is commutative 25. Which one of the following regular expressions
(c) If for all x, y G, (xy)2 = x2y2, then G is correctly represents the language of the finite
commutative. automation given below ?
(d) If for all x G, x 2 = 1, then G is a
b
commutative. Here, 1 is the identity element
of G.
b
Sol: (b, c, d) a
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
(a) (ab*b)*ab* + (ba*a)*ba* results in an increase of cache access latency to
(b) ab* bab* + ba* aba* 15 ns, whereas the miss penalty is not affected.
The minimum hit rate (rounded off to two
(c) (ab* b + ba*a)* (a* + b*)
decimal places) needed after the optimization
(d) (ba*a + ab*b)* (ab* + ba*) such that it should not increase the average
Sol: (d) memory access time is _________.
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Employee(eld,Name), Brand(bld,bName), 2x
60
Own(eld,bld) 230
1×
Which of the following relational algebra 8
expressions return the set of elds who own all 60 × 230
2x =
the brands ? 8
(a) eld (( eld (Own) × bld (Own)) / bld 60 × 230
log 2x > log
(Brand) 8
x > log 60 + 30 – log 8
(b) eld eld bld Own / bld Brand Minimum value of x = 30 + 5.9 – 3
(c) eld (Own) – eld (( eld (Own) × bld 33
(Brand)) – eld bld (Own))
31. The number of arrangements of six identical
balls in three identical bins is __________.
(d) eld eld bld Own / bld (Own)
Sol: (7)
Sol: (b, c)
So, balls and bins are identical, the possible
Given three relation,
ways are :
Employee(eId, Name)
We have three bins.
Brand(bId, bName)
B1 B2 B3
Own(eId, bId) 6 0 0
Need to find “set of eIds who own all the brands”. 5 1 0
Required answer, 4 1 1
4 2 0
eId eId,bId own bId Brand 3 2 1
eId own – eId ( eId own × bId Brand 3 3 0
– eId, bId own ) 2 2 2
Total ways is 7.
30. Consider the data transfer using TCP over a 1
Gbps link. Assuming that the maximum 32. What is printed by the following ANSI C
segment lifetime (MSL) is set to 60 seconds, the program?
minimum number of bits required for the
#include<stdio.h>
sequence number field of the TCP header, to
prevent the sequence number space from int main(int argc, char *argv[ ])
wrapping around during the MSL is {
___________.
int a[3] [3] [3] =
Sol: (33)
{ { 1, 2, 3, 4, 5, 6, 7, 8, 9} ,
230 {10, 11, 12, 13, 14, 15, 16, 17, 18},
Bandwidth = 1 GbPS = bytes sec
8 {19, 20, 21, 22, 23, 24, 25, 26, 27}};
Maximum segment lifetime (MSL) = 60 seconds int i = 0, j = 0, k = 0;
Total sequecne number for (i + 0; i < 3; i++ ) {
Wrap around time =
Bandwidth for (k = 0; k < 3; k++ )
Wrap around time > Maximum segment lifetime
printf(“%d”, a[i] [j] [k]) ;
Total sequecne
printf (“\n”) ;
number > Maximum segment life time.
Bandwidth }
Suppose, minimum number of bits required for return 0;
the sequence number field = x. }
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
1 2 3 speed of 3 × 108 m/s. The time taken (in
(a) 10 11 12 milliseconds, rounded off to two decimal places)
for the receiver to completely receive a packet of
19 20 21
1000 bytes transmitted by the sender is
1 2 3 _________.
(b) 4 5 6 Sol: (7.08)
7 8 9
Given, Bandwidth = 100 Mbps
1 4 7
Distance = 2100 Km.
(c) 13 14 15
25 26 27 Propagation speed = 3 ×108 m sec
1 4 7 Time taken to receive the packet
(d) 10 13 16
= Transmission time + Propagation time
19 22 25
Packet size 1000 bytes
Sol: (a) Transmission time = =
Bandwidth 100 Mbps
X[3] [3] [3]
1000 × 8 bits
=
100 ×106 bits sec
Three 2D arrays
2 7 8 9 2 16 17 18 = 7 ×10 –3 sec
= 7 msec.
0 1 2
a[2] Required time = 7 + 0.08 = 7.08 msec.
0 19 20 21
34. Suppose a binary search tree with 1000 distinct
1 22 23 24 elements is also a complete binary tree. The
tree is stored using the array representation of
2 25 26 27 binary heap trees. Assuming that the array
indices start with 0, the 3rd largest element of
a[000] = 1 the tree is stored at index __________.
a[001] = 2
Sol: (509)
a[002] = 3
Given binary search tree with 1000 distinct
a[100] = 10
elements. And the tree is stored using the array
a[101] = 11 representation of binary heap trees. Array
a[102] = 12 indices start with 0.
a[200] = 19 Index number of first node at each level can be
a[201] = 20 found by (2h –1), where h is the height of the
a[202] = 21 tree.
And, Number of node at each level can be find
33. Consider a 100 Mbps link between an earth
out by (2n –1), where n is the number of level.
station (sender) and a satellite (receiver) at an
altitude of 2100 km. The signal propagates at a
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Level Height Sol: (a)
1 0 0 2000 0 1 4000
Compute
1 , z 10 11 , Null
(Line 1)
2 1 2 1 x 3000 3002 p
3 3 1 5 6 2 x 0 1 p
Compute
1 , z 10 11 , Null 2000
(Line 2)
2000 3000 3002 4000
x 0 1 p
Compute
10 511 999 9
1 10 , z 10 11 , 2000
(Line 3)
2000 3000 3002 4000
At 10th level number of nodes = 210–1 = 512. x 0 1 p
Compute
At height 9, index number of first node 10 , z 10 11 , 3002
(Line 4)
2000 3000 3002 4000
= 29 – 1 = 511 * &z 0 +1 + = 3
Since, total number of node is 1000, so we need * 3000 +1 + = 3
to check upper level. Because rightmost number
in binary seachtree is maximum. * 3002 + = 3
(11)+ = 3
At 9th level, no. of nodes = 29–1 = 256 .
14
At high 8, index no. of first node = 28 – 1 = 255 . x z[0] z[1] p
Index number of last node in 9th level, 10 10 14 , 3002
2000 3000 3002 4000
= 255 × 2 x = 10
= 510 z[0] = 10
z[1] = 14
Second largest
36. The following simple undirected graph is referred
to as the Peterson graph.
509 510 height = 8
Largest number
Third largest
Required answer = 509
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
(c) The graph has a Hamiltonian path. Sol: (c)
(d) The chromatic number of the graph is 3.
p
Sol: (a, c, d)
(a) Yes, it is isomorphic to the given graph. (c) Consider a graph q
Step-I r
A
B
I B p q r
p 0 1 0
F A C
H C G H
J K is adjacency matrix = q 1 0 1
I J
r 0 1 0
G D
E D
F E
0 1 0 0 1 0
B K2 = 1 0 1 1 0 1
0 1 0 0 1 0
A
F C
G H
1 0 1
I J
= 0 2 0
E D 1 0 1
(b) Vertex independent set is a set of vertices
which are not adjacent. Degree sequence of (p, q, r) = (1, 2, 1)
Maximal vertex independent set is a set in Diagonal elements = (1, 2, 1)
which we cannot add one more vertex to it.
38. Consider a simple undirected graph of 10
So, largest independent set of Peterson graph
vertices. If the graph is disconnected, then the
is 4.
maximum number of edges it can have is
(c) Peterson graph has Hamiltonian path but _________.
not Hamiltonian cycle.
Sol: (36)
(d) Yes, it is true.
We are given that vertices = n
B G
The maximum number of possible edges in an
A R undirected graph with ‘n’ vertices and ‘k’
F C R R
G H B G components is :
I J B G Example :
E D G B To get maximum edges, take one vertex each
for each complement, except last component.
37. Which of the properties hold for the adjacency
Now, (K–1) components have 1 vertex each and
matrix A of a simple undirected unweighted
last component has n–(K–1) vertices. Make the
graph having n vertices ?
last component complete i.e. it has
(a) If the sum of all the elements of A is at
n – K n – K +1
most 2(n – 1), then the graph must be n– k–1 C =
2 2
acyclic.
n – K n – K +1
(b) If the graph is connected, then none of the Number of edges (e) =
entries of An–1 + In can be zero. 2
Complement (K) = 2
(c) The diagonal entries of A2 are the degrees of
the vertices of the graph. 10 – 2 10 – 2 +1
=
(d) If there is at least a 1 in each of A’s rows 2
and columns, then the graph must be 8×9
connected. = = 36
2
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
39. Which one of the following statements is TRUE (b) Given a Turing machine M, decide if M
for all positive functions f(n) ? accepts all strings.
(c) Given a Turing machine M, decide if M
2
(a) f n = f n
2
takes more than 1073 steps on every
string.
f n = o f n
2 2
(b)
(d) Given two Turing machine M1 and M2,
decide if L(M1) = L(M2).
f n = O f n , when f(n) is an exponen-
2 2
(c)
Sol: (a, b, d)
tial function
(a) Undecidable
2
(d) f n = f n
2
, when f(n) is a polynomial (b) Undecidable
Sol: (d) (c) Decidable, Turing Machine M decide if
language L takes more than 1073 steps.
Growth rate of exponential function is greater
than polynomial function. Language L takes almost 1073 steps,. So,
it is decidable. Then its complement is also
Thus, f n 2 = f n , when f(n) is a polyno-
2
decidable. Hence, L is decidable.
mial. (b) Undecidable
40. Consider a simple undirected weighted graph 42. Let G(V, E) be a directed graph, where V = {1,
G, all of whose edge weights are distinct. Which 2, 3, 4, 5} is the set of vertices and E is the set
of the following statements about the minimum of directed edges, as defined by the following
spanning trees of G is/are TRUE ? adjacency matrix A.
(a) The edge with the second smallest weight is 1, 1 j i 5
always part of any minimum spanning tree A[i][j] =
of G. 0, otherwise
(b) Suppose S V be such that S and A[i][j] = 1 indicates a directed edge from node i
to node j. A directed spanning tree of G, rooted
S V. Consider the edge with the minimum
at r V, is defined as a subgraph T of G such
weight such that one of its vertices is in S
that the undirected version of t is a tree, and T
and the other in V/S. Such an edge will
contains a directed path from r to every
always be part of any minimum spanning
other vertex in V. The number of such
tree of G.
directed spanning trees rooted at vertex 5 is
(c) G can have multiple minimum spanning _______.
trees.
Sol: (24)
(d) One or both of the edges with the third
smallest and the fourth smallest weights Given vertex,
are part of any minimum spanning tree of V = {1, 2, 3, 4, 5}
G.
A matrix ‘A’ is given in such a way that,
Sol: (a, b, d)
1 1 j i 5
(a) TRUE A i j =
(b) TRUE 0 Otherwise
i
(c) No, G can not have multiple minimum
spanning trees when all the edges are 1 2 3 4 5
distinct. 1 1 0 0 0 0
(d) TRUE 2 1 1 0 0 0
j 3 1 1 1 0 0
41. Which of the following is/are undecidable ?
4 1 1 1 1 0
(a) Given a Turing machine M, decide if L(M)
5 1 1 1 1 1
is regular.
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
12.20.10100100.00000000
V2 V4 12.20.10100110.00000000
Network id Host id
12.20.164.0/22
V1
44. Suppose we are given n keys, m hash table slots,
and two simple uniform hash functions h1 and
V3 V5 h2. Further suppose our hashing scheme uses h1
for the odd keys and h2 for the even keys. What
Directed spanning tree rooted at vertex 5 is is the expected number of keys in a slot ?
Which of the following prefixes in CIDR notation 45. Which one of the following statements is
can be collectively used to correctly aggregate FALSE?
all of the subnets in the routing table ?
(a) The memory access time using a given
(a) 12.20.168.0/22 (b) 12.20.164.0/21 inverted page table is always same for all
(c) 12.20.164.0/22 (d) 12.20.164.0/20 incoming virtual addresses.
Sol: (a, c) (b) If the virtual address of a word given by
CPU has a TLB hit, but the subsequent
Given routing table, search for the word results in a cache miss,
1. 12.20.164.0 255.255.252.0 then the word will always be present in the
main memory.
12.20.10100100.00000000
(c) The TLB performs an associative search in
2. 12.20.170.0 255.255.254.0 parallel on all its valid entries using page
number of incoming virtual address.
12.20.10101010.00000000
(d) In a system that uses hashed page tables, if
3. 12.20.168.0 255.255.254.0 two distinct virtual addresses V1 and V2
12.20.10101000.00000000 map to the same value while hashing, then
the memory access time of these addresses
4. 12.20.166.0 255.255.254.0
will not be the same.
12.20.10100110.00000000 Sol: (a)
Subnet (2) and (3) can be aggregated. (a)
Inverted Page table
12.20.10101010.00000000
frame 0 Process Page
12.20.10101000.00000000
Network id Host id
Frame 1 Process Page
12.20.168.0/22
Subnet (1) and (4) can be aggregated
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Memory access time using inverted page table 17 22 27
is not some because in inverted page table
no indexing is applied and there is no equal tr(BA) = 22 29 36 = 17 +19 + 45 = 91
27 36 45
linear searching. So, this statement is false.
(b) TLB hit means word will always present in 91 = 91
main memory. Statement I is correct.
(c) TLB perform parallel search. Statement-II :
(d) Virtual address entry number. tr Cn×n × Dn×n = tr Dn×n × Cn×n
Entry number Take example,
2 2 1 2
C= ,D=
3 5 2×2 3 4 2×2
If they map to same value while hashing, 8 12
there memory access time of addresses will tr(CD) = = 8 + 26 = 34
18 26
not same because there is a chance that
some elements are present at the end of 8 12
linked list. tr(DC) = = 26 + 8 = 34
18 26
46. Consider the following two statements with Statement II is also true.
respect to the matrices Am×n, Bn×m, Cn×n and
47. Which of the following statements is/are TRUE?
Dn×n.
Statement 1: tr(AB) = tr(BA) (a) Every subset of a recursively enumerable
language is recursive.
Statement 2: tr(CD) = tr(DC)
(b) If a language L and its complement L are
where tr () represents the trace of a matrix.
both recursively enumerable, then L must
Which one of the following holds ?
be recursive.
(a) Statement 1 is wrong and Statement 2 is cor-
(c) Complement of a context-free language must
rect.
be recursive.
(b) Statement 1 is correct and Statement 2 is
wrong. (d) If L1 and L2 are regular, then L1 L2 must
(c) Both Statement 1 and Statement 2 are correct be deterministic context-free.
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
char a = ‘P’ ; R A = 0 × C1400000
char b = ‘x’ ; R B = 0 × 42100000
char c = (a & b) + ‘*’ ; RC = 0 × 41400000
char d = (a | b) – ‘–’ ; Which one of the following is FALSE ?
char e = (a ^ b) + ‘+’ ; (a) B = 3C (b) A + C = 0
printf(“%c %c %c/n”, c, d, e); (c) (B – C) > 0 (d) C = A + B
return 0; Sol: (d)
} C=A +B
ASCII encoding for relevant characters is given R A = 0 × C1400000 1100 0001 0100 00000
below R B = 0 × 42100000 0100 0010 0001 00000
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
In programmed I/O CPU time is wastes. –9 –6 –2 –4
In interrupt driven I/O at particular time
–8 –6 –3 –1
interval CPU check the interrupt and CPU 20 15 8 5
transfer the data to memory as per interrupt
requirement. But it doesn’t transfer the data 32 21 7 12
with maximum throughput. –1 0
In polling based I/O, the I/O device is
0 1
continuously poll by asking whether it needs
(a) 2 (b) –3
CPU or not. So it also transfer data to main
memory with low throughput. 2 0
DMA based I/O transfer doesn’t involved CPU 1 –1
for transferring data to main memory and its
0 1
throughput is maximum.
(c) –1 (d) 0
51. Consider two files systems A and B, that use 0 1
contiguous allocation and linked allocation,
Sol: (a, b, d)
respectively. A file of size 100 block is already
stored in A and also in B. Now, consider This question is solved with verification of option.
inserting a new block in the middle of the file This will help us to take less time.
(between 50th and 51st block), whose data is Use AX = X in each options.
already available in the memory. Assume that
= Scalar quantity.
there are enough free blocks at the end of the
file and that the file control blocks are already (a) AX = X
in memory. Let the number of disk accesses –9 –6 –2 –4 –1 –1
required to insert a block in the middle of the
file in A and B are nA and nB, respectively, then –8 –6 –3 –1 0 0
= 3 AX = 3X
20 15 8 5 2 2
the value of nA + nB is ________.
Sol: (153) 32 21 7 12 2 2
52. Which of the following is/are the eigen vector(s) 53. Consider a system with 2 KB direct mapped
for the matrix given below ? data cache with a block size of 64 bytes. The
system has a physical address space of 64 KB
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
and a word length of 16 bits. During the • Every access of S is hit.
execution of a program, four data words P, Q, • Once P is brought to the cache it is never
R and S are accessed in that order 10 times (i.e. evicted.
PQRSPQRS). Hence, there are 40 accesses to
data cache altogether. Assume that the data • Every access to R evicts Q from cache.
cache is initially empty and no other data words 54. Consider the following languages :
are accessed by the program. The addresses of
the first bytes of P, Q, R and S are 0xA248, L1 = a n wa n |w a,b *
0xC28A, 0xCASA, and 0xA262, respectively. For
L 2 = wxw R |w,x a,b *, w , x 0
the execution of the above program, which of
the following statements is/are TRUE with Note that wR is the reversal of the string w.
respect to the data cache ? Which of the following is/are TRUE ?
(a) Every access to S si a hit (a) L1 and L2 are context-free
(b) At the end of the execution only R and S (b) L1 and L2 are regular
reside in the cache.
(c) L1 is regular and L2 is context-free.
(c) Once P is brought to the cache it is never
evicted (d) L1 and L2 are context-free but not regular.
But P&S are from same memory block (10100). Student Dept
0 sNo sName dNo dNo dName
1st 2nd
S01 James D01 D01 CSE
8 P:M P : Hit
S02 Rocky D01 D02 ESE
9 Q: M Q:M
10 P S03 Jackson D02
R;M R:M
11 R S04 Jane D01
S : Hit S :Hit
S05 Milli D02
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Course Register = R1 – R1 R 2 .
cNo cName dNo sNo cNo Now, NOT EXIST returns TRUE and outer
C11 DS D01 S01 C11 query gives <S01, James, D01> as output.
C12 OS D01 S01 C12 When second inner query is checked for sNo =
S02. It return <C11>. And the except operation
C21 DE D02 S02 C11
between two inner query gives non-empty
C22 PT D02 S03 C21 result. AND NOT EXISTS gives FALSE result.
C23 CV D03 S03 C22 And outer query doesn’t give any result.
S03 C23 Similarly for sNo = S04, outer query gives
output <S04, jane, D01>.
S04 C11
Hence 2 rows found.
S04 C12
56. Consider the following grammar along with
S05 C11
translation rules.
S05 C21
S S1 # T S.val = S1.val * T.avl
SQL query :
SELECT * FROM Student As a WHERE NOT
ST S.val = T.val
EXIST T T1 %R T.val = T1.val R .val
(select cNo from Course where dNo = “D01” TR T.val = R .val
EXCEPT. R id R.val = id.val
SELECT cNo FROM Register WHERE sNo = Here # and % are operators and id is a token
S.sNo) that represents an integer and id.val represents
The number of rows returned by the above SQL, the corresponding integer value. The set of nono-
query is _____. terminals is {S, T, R, P} and a subscripted non-
terminal indicates an instance of the non-
Sol: (2) terminal.
Given schemes, Using this translation scheme, the computed
value of S.val for root of the parse tree for the
Student(SNO, SName, dNo)
expression 20#10%5#8%2%2 is ______.
Dept(dNo, dName) Sol: (80)
Course(CNO, CName, dNo) S S1 # T S.val = S1 va l * T. val
Register (SNo, CNo) ST S.val = T.val
Select * from student as S where NOT EXIST T T1 %R T.val = T1.val R.val
(select CNO from course where dNo = “DO1” TR T.val = R.val
EXCEPT R id R.val = id.val
Select CNO FROM Register WHERE 20 ×10 5 × 8 2 2
SNO=S.SNO) Rule 1 : has higher priority then * because it
In above case, first inner query return is is away from starting symbol.
independent and return <{C11, C12>. Rule 2 : Both ( and *) are left associative.
Second inner query is dependent on student 20 ×10 5 × 8 2 2
relation. The condition is sNo = S.sNo. 20 × 2 × 4 2
So, for sNo = S01, second inner query returns 20 × 2 × 2
<C11, C12>. And the except operation between 40 × 2 = 80
two inner query gives empty result.
57. Consider solving the following system of
Except operation : R1 EXCEPT R2
simultaneous equation using LU decomposition.
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
x1 + x 2 – 2x 3 = 4 1 1 0 1 0 –2
1 1 –2
x1 + 3x 2 – x 3 = 7 1 1 0 0 2 1
1 3 –1 =
2x1 + x 2 – 5x 3 = 7 1 1
2 1 –5 2 – 1 0 0 –
2 2
where L and U are denoted as
1
L11 0 0 U11 U12 U13 u33 = –
2
L = L 21 I22 0 , U = 0 0 U 23 1
L L32 = –
31 I32 I33 0
0 U 33 2
Which of the followin g is the corr ect 58. Which one of the following statements is
combination of values for L32, U33, and x1 ? TRUE ?
1
R3 R3 – – R2
2
R-R conflict
1 1 –2 in LALR
0 2 1 A ., a b
u= 1 B ., a b
0 0 –
2
A = L*u 59. Consider the problem of reversing a singly linked
list. To take an example, given the linked list
below,
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
head a b c d e T1 T2 T3 T4
R4(x)
the reversal linked list should look like.
R2(x)
head c d c b a
R3(x)
R1(y)
Which one of the following statements is TRUE
W1(y)
about the time complexity of algorithms that
W2(x)
solve the above problem in O(1) space ?
W3(y)
(a) The best algorithm for the problem takes
R4(y)
n time in the worst case.
(b) It is not possible to reverse a singly linked
T1 T2
list in O(I) space.
(c) The best algorithm for the problem takes
n log n time in the worst case. T3 T4
a b c d
Thus, T1 T3 T4 T2
NULL
61. Let R1 and R2 be two 4-bit register that store
NULL a b c d numbers in 2’s complement form. For the
operation R1+R2, which one of the following values
60. Let R1(z) and W1(z) denote read and write of R1 and R2 gives an arithmetic overflow ?
operations on a data element z by a transactionTi, (a) R1 = 1001 and R2 = 1111
respectively. Consider the schedules S with four (b) R1 = 0011 and R2 = 0100
transactions. (c) R1 = 1100 and R2 = 1010
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
R2 = 0100
R1 + R2 = 0 0 1 1
0 1 0 0
0 1 1 1 Branch 30% 70%
Non-Branch
No overflow occurred, because sign bit is
same for (R1 + R2). 2 Stalls 0 Stalls
(c) R1 = 1100 CPI = 1 + Number of stalls instruction
= 1 + (0.3) × 2
R2 = 1010
= 1.6
R1 + R2 = 1 1 0 0
Average instruction execution time
1 0 1 0
= CPI * Cycle time
0 1 1 0
= 1.6 * 0.5n sec
Overflow occurred, because sign bit is = 0.8 ns.
different for (R1 + R2). X2 “If BPU predicted correct branch then
(d) R1 = 1011 it eliminate stalls but if BPU predicted
R2 = 1110 wrong branch then BPU not add any
additional stalls but remaining stalls
R1 + R2 = 1 0 1 1 we present.”
1 1 1 0 with branch
1 0 0 1 prediction
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]
Detailed Solution CS
05-02-2022 | FORENOON SESSION
Given page reference string, There are 4-pairs involved in completely
resolving the domain name.
7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1
65. Consider the following resource :
Number of page faults
Page fault rate = f1 = 1;
Number of memory access
f(2n) = 2f n – 1, for n 1
There are four page frames are given and LRU
page replacement policy is used. f(2n + 1) = 2f n +1, for n 1
7 2 7 3 2 5 3 4 6 7 7 1 5 6 1 Then, which of the following statements is/are
5 5 5 7 7 7 TRUE ?
3 3 3 3 3 1 1 (a) f 2n +1 = 2n +1 (b) f 5.2n = 2n+1 +1
2 2 2 2 6 6 6 6
(c) f 2n – 1 = 2n – 1 (d) f 2n = 1
7 7 7 7 4 4 4 4 5
Sol: (b, c, d)
Number of Page fault = 9
Eliminating option is the best way for solving
Number of memory access = 15
this question f 2n is even function and
9
Page fault rate = = 0.6
15 f 2n +1 is odd function.
Authoritative DNS
Server
F-126, Katwaria Sarai, N ew Delhi - 110 016 Ph: 011-41013406, Mobile: 8130909220, 9711853908
Web: www.iesmaster.org | E-mail: [email protected]