0% found this document useful (0 votes)
50 views26 pages

GATE 2022 Paper Solution (CS) IESMaster

This document contains solutions to 7 aptitude questions: 1) Finding the value of an expression involving roots of a quadratic equation. 2) Identifying the correct logical inference about metrics based on a passage. 3) Defining a palindrome and solving a word game problem. 4) Determining which statement is correct based on information about labeling points on a triangle. 5) Calculating the probability of drawing an orange ball from a box with different colored balls. 6) Finding the minimum number of ropes needed to divide a space into plots. 7) Calculating the area under a piecewise defined function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views26 pages

GATE 2022 Paper Solution (CS) IESMaster

This document contains solutions to 7 aptitude questions: 1) Finding the value of an expression involving roots of a quadratic equation. 2) Identifying the correct logical inference about metrics based on a passage. 3) Defining a palindrome and solving a word game problem. 4) Determining which statement is correct based on information about labeling points on a triangle. 5) Calculating the probability of drawing an orange ball from a box with different colored balls. 6) Finding the minimum number of ropes needed to divide a space into plots. 7) Calculating the area under a piecewise defined function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Detailed Solution CS

05-02-2022 | FORENOON SESSION


player has the following two plates painted with
APTITUDE letters.

1. Let r be a root of the equation x 2 + 2x + 6 = 0 . A D


Then th e value of th e expression
From the additional plates given in the options,
 r + 2  r + 3  r + 4   r + 5  is
which one of the combinations of additional
(a) 126 (b) –51 plates would allow the player to construct a
(c) 51 (d) –126 five-letter palindrome. The player should use
all the five plates exactly once. The plates can
Sol: (d)
be rotated in their plane.
r be the root of the equation x 2 + 2x + 6 = 0 so
it will satisfy (a)
r 2 + 2r + 6 = 0 ...(i)
(b)
Now,  r + 2  r + 3   r + 4   r + 5 
  r 2 + 5r + 6  r 2 + 9r + 20  (c)
  r 2 + 2r + 6 + 3r  r 2 + 2r + 6 + 7r +14 
  0 + 3r  0 + 7r +14  (d)
 3r 7r +14  Sol: (c)
 21  r 2 + 2r  = 21  –6  A word, sentence or a number that reads the
 –126 same backward or forward.
Option (d) is correct. Ex. RADAR

2. Some people believe that “what gets measured, MADAM


improves”. Some others believe that “what gets REFER
measured, gets gamed”. One possible reason for
12321
the difference in the beliefs is the work culture
e in organizations. In organizations with good So, option (c) R A R (after rotating
work culture, metrices help improve outcomes. 2nd and 3rd plates) is a palindrome.
However, the same metrices are counterproduc-
tive in organizations with poor work culture. Option (c) is correct.
Which one of the following is the CORRECT 4. The corners and mid-points of the sides of a
logical inference based on the information in triangle are named using the distinct letters,
the above passage ? P, Q, R, S, T and U, but not necessarily in the
(a) Metrices are always counterproductive in same order. Consider the following statements :
organizations with good work culture • The line joining P and R is parallel to the
(b) Metrices are useful in organizations with line joining Q and S.
good work culture. • P is placed on the side opposite to the corner
(c) Metrices are useful in organizations with T.
poor work culture. • S and U cannot be placed on the same side.
(d) Metrices are never useful in organizations Which one of the following statements is correct
with good work culture. based on the above information ?
Sol: (b) (a) P cannot be placed at a corner
Metrices are useful in organizations with good (b) R cannot be placed at a corner
work culture. (c) S cannot be placed at a corner
3. A palindrome is a word that reads the same (d) U cannot be placed at a mid-point
forwards and backwards. In a game of words, a Sol: (c)

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

getting an orange ball in the next draw ?


R5
23 1
(a) (b) R3
50 2
19 8 R1
(c) (d) R4
50 25
Sol: (a)
R3  First additional Rope
G  green
R4  Second additional Rope
O  Orange
Green
R5  Third additional Rope
2/4
2G
Green So, using 3 additional ropes. We are able to
3/5
20 divide into 4 similar shape plots.
3G 2/4 Orange

20 3/5 Green 7. A function y(x) is defined in the interval [0, 1]


2/5 3G on the x-axis as
Orange
2O
2/5 Orange  1
 2 if 0  x  3
3 2 2 2 
P(E) = × + ×  1 3
5 4 5 5 y(x) = 3 if  x 
 3 4
3 4
= +  3
10 25  1 if  x  1
 4
23 Which one of the following is the area under
=
50 the curve for the interval [0, 1] on the x-axis.
Option (a) is correct.
13 6
(a) (b)
6. A plot of land must be divided between four 6 5
families. They want their individual plots to be 5 6
similar in shape, not necessarily equal in area. (c) (d)
6 13
The land has equally spaced poles, marked as

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

(b) The number of boys who qualified the test is


less than the number of girls who qualified.
(c) Equal number of boys and girls appeared for
the test

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 :

The cache eviction is a strategy in which the L1 = ww|w  a,b *


data is removed from the cache.
L 2 = a n b nc m |m,n  0
(i) To make room for more relevant cache
entries. L3 = a m b n cn |m,n  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
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

(b) L2, L3 and L 2  L3 all are context-free Sol: (–0.5)


(c) Neither L1 nor L2 is complement is context-
free x
Lim
(d) L1 is not context-free but L2 and L3 are 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.

Language L1 is not accepted by PDA, because 2 x


we can’t figure out middle element of string. 1
x
Hence it is not context free language. 2
 Lim+
x 0 1
Language L2 is accepted by PDA, because each –2e2 x .
element ‘a’ is pushed in the stack and for each 2 x
element ‘b’ pop operation is performed, and 1
finally any number of input symbol ‘c’ is possible.  xLim
0 + –2e 2 x
Hence language L2 is context free language.
1
Language L3 is accepted by PDA, because after  – = –0.5
2
any number of input element ‘a’, for element ‘b’
push operation in performed and for element ‘c’ 15. Which one of the following is the closed form for
pop operation is performed & stack becomes empty. the generating function of the sequence an n 0
Hence, language L3 is context free language. defined below ?
Thus, L1 - Not context free
L2 - Context free. n +1, n is odd
an = 
Option (a) is FALSE.  1, otherwise

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

L1 - Not context free


Sol: (a)
L1 - Context free
n +1 if n is odd
Option (c) is FALSE. an = 
1 otherwise
L1 - Not context free
 n – 1 n – K +1
L2 - Deterministic context free = a 0 + a1x + a 2x 2 + a3x 3
2
L3 - Deterministic context free +a 4 x 4 + a 5x 5 + ...

Option (d) is TRUE. = 1 + 2x + x 2 + 4x 3 + x 4 + 6x 5 + ...

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 + x + x 2 + x 3 + ....  + x 1 + 3x 2 + 5x 4 + ...  Step (1)


1 d 
=  +x x + x 3 + x 5 + ...  Q 1: 1 2 3 4
1 – x dx
1 d  x 
=  +x Head
1 – x dx  1 – x 2  
1 x 1 + x 2  Q2 1
= 1 – x  +
1 – x 2 2
Head
16. Consider the queues Q1 containing four elements
Step (2)
and Q2 containing none (shown as the initial
state in the figure). The only operations allowed
on these two queues are Enqueue (Q, element) Q 1: 1 2 3 4
and Dequeue (Q). The minimum number of
Enqueue operations on Q1 required to place the Head
elements of Q1 in Q2 in reverse order (shown as
the final state in the figure) without using any Q 2: 2 1
additional storage is _________.
Head Initial state Head Final state
Head
Step (3)
Q1 1 2 3 4 Q1

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

S is a 1024-word memory segment. 21. Consider four processes P, Q, R and S scheduled


R is a 32-word register file. on a CPU as per round robin algorithm with a
time quantum of 4 units. The processes arrive
So, there are 10-input required for decoder P in the order P, Q, R, S, all at time t = 0. There
and output of decoder P is 210. is exactly one context switch from S to Q,
Similarly, there are 5-input required for decoder exactly one context switch from R to Q and
Q and output of decoder Q is 25. exactly two context switch from Q to R. There
is no context switch from S to P. Switching to
And T is a multiplexer, which takes 2 input a ready process after the termination of another
and gives 1 output. process is also considered a context switch.
P  10:210 decoder Which one of the following is NOT possible as
CPU burst time (in time units) of these
R  5:25 decoder
processes?
T  2:1 Multiplexer (a) P = 4, Q = 12, R = 5, S = 4
20. Consider an enterprise network with two (b) P = 2, Q = 9, R = 5, S = 1
Ethernet segments, a web server and a (c) P = 3, Q = 7, R = 7, S = 3
firewall, connected via three routers as shown (d) P = 4, Q = 10, R = 6, S = 2
below:
Sol: (c)
Router
Internet Given four processes P, Q, R and S.
Firwall
Scheduling algorithm : Round Robin

Router Router
Time quanta = 4 time unit.
Web Server
All the processes arrives at time t = 0.

Ethernet Ethernet (i) Exactly one context switch from S to Q.


(ii) Exactly one context switch from R to Q.
(iii)Exactly two context switch from Q to R.
What is the number of subnets inside the (iv) No context switch from S to P.
enterprise network ? (v) Switching to a ready process after the
(a) 3 (b) 6 termination of another process is also
considered a context switch.
(c) 8 (d) 12
P Q R S Q R Q
Sol: (b)
A.
Given an enterprise network with two ethernet 0 4 8 12 16 20 21 25

segments, a web server and a firewall connected

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

(a) If G is commutative then the subgroup is G


a
is also commutative.
b

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 _________.

Given finite automation, Sol: (85%)

b Cache memory hit rate = 0.8


a
Access Latency = 10 nsec.
Miss penalty = 100 nsec.
b
a Optimization increases cache access latency to
15 nsec.

b a Miss penalty is not affected.


Average memory access time in first case
(P + Q)*
= 0.8 ×10 + 1 – 0.8  ×100 = 28n sec
Average memory access time in second case
= x ×15 + 1 – x  ×100 = 28
 P + Q * ab * +ba * 
15x +100 – 100x = 28
 ab * b + ba * a  * ab * +ba * 
85x = 72
26. Consider the augmented grammar with {+, *, 72
(,), id} as the set of terminals. x = = 0.85
85
S  S 28. Which of the following statements is/are TRUE
S S+R R with respect to deadlocks ?
R  R*P P (a) If the current allocation of resources to
processes leads the system to unsafe state,
P   S  id then deadlock will necessarily occur.
(b) Circular wait is a necessary condition for
If I0 is the set of two LR (0) items {[S'  S,], [S
the formation of deadlock.
 S, + R]}, then goto (closure (I0), +) contains
exactly ___________ items. (c) In the resource-allocation graph of a system,
if every edge is an assignment edge, then
Sol: (5)
the system is not in deadlock state.
Apply augmented grammar is : (d) In a system where each resource has more
I0 (Closure (I0), +) than one instance, a cycle in its wait-for
S S   S. + graph indicates the presence of a deadlock.
S  .S S  S + .R
S  S. + R Sol: (b, c)
S  .S + R R  .R * P
S  .R R  .P (a) An unsafe state doesn’t leads to deadlock.
R  .R * P P  . S 
(b) Circular wait is a necessary condition for
R  .P P  .id
the formation of deadlock.
P  .id
Total = 5 items
P  . S  (c) If there is no request edge then no deadlock.
(d) No deadlock occurred when more than one
instance of resource exist.
27. A cache memory that has a hit rate of 0.8 has
an access latency 10 ns and miss penalty 100 29. Consider the following three relations in a
ns. An optimization is done on the cache to relational database.
reduce the miss rate. However, the optimization

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

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

Three 1-D array in


= 0.08 Msec.
each 2-D array
Dis tan ce
Three element in Propagation time =
each1-D array Pr opagation speed
0 1 2 0 1 2 2100 Km
a[0] a[1] =
0 1 2 3 0 10 11 12 3 ×108 m sec
2100 ×103 m
1 4 5 6 1 13 14 15 =
3 ×108 m sec

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

35. What is printed by the following ANSI C


program ?
#include<stdio.h> Which of the following statements is/are TRUE?
int main (int argc, char *argv [] ) The following graph is isomorphic to the
{ Peterson graph.
int x = 1, z [2] = [10, 11];
int *p = NULL;
p = &x;
*p = 10;
(a)
p = &z [1];
* (&z[0] + 1) + = 3;
printf(“%d, %d, %d\n”, x, z[0], z[1] );
(b) The size of the largest independent
return 0; set of the given graph is 3. (A subset of
} vertices of a graph form an independent
(a) 10, 10, 14 (b) 1, 10, 11 set if no two vertices of the subset are
adjacent.)
(c) 10, 14, 11 (d) 1, 10, 14

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 ?

4 × 3 × 2 × 1 = 24 (a) 2n/m (b) n/m


(c) m/n (d) n/2m
43. Consider routing table of an organization’s router
shown below: Sol: (b)
Number of keys = n
Subnet Number Subnet Mask Next Hop
12.20.164.0 255.255.252.0 R1 Number of slots = m
12.20.170.0 255.255.254.0 R2 As per question, we need to find out number of
12.20.168.0 255.255.254.0 Interface 0 expected keys in a slot, i.e. each slot how many
12.20.166.0 255.255.254.0 Interface 1 keys are possible.
default R3 So, each slot expected key should be n/m.

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.

(d) Both Statement 1 and Statement 2 are wrong. Sol: (b, c, d)

Sol: (c) (a) It is not necessary that every subset of a


recursively enummable language is
The trace of a matrix is the sum of the diagonal recursive.
elements of the matrix.
(b) If language L and its complement ( L ) both
• In this question, property of trace is used
are recursively enumerable then L must be
that is trace of product (AB) = trace of
recursive.
product (BA)
(c) Context free language is recursive so its
• Statement I  it said tr  A m×n × Bn×m  =
complement is also recursive.
tr  Bn×m × A m×n  . (d) Regular languages are closed under
Let take example. intersection, so their intersection must be
deterministic context free.
1 4 
1 2 3   
A=  , B = 2 5  48. What is printed by the following ANSI C
 4 5 6  2×3 3 6  program?
  3×2
#include<stdio.h>
14 22
tr(AB) =   = 14 + 77 = 91 int main (int argc, char *argv [ ] ) {
32 77 

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

A B C  Z a b c  z R C = 0 × 41400000  0100 0001 0100 00000


65 66 67  90 97 98 99  122 If you see carefully A and C are changes only
in sign bit.
* + –
IEEE-754 single precision =  –1S *1.M * 2E–127 .
42 43 45
In every register, first bit is sign bit, next 8 bit
(a) P x + (b) z K S is for exponent, and after that remaining bit is
(c) 122 75 83 (d) * – + mantissa.
Sol: (b) RA = 1100 0001 01000 00000

Step-I  80 = Sign = (–)


120 because we take small ‘p’
a b = Exponent = 130
and capital ‘X’. =  –1 –1 1.1 × 2130–127
char c  (a & b) + ‘*’ = –1.1 × 23
 Bitwise & = (80 & 120) + 42 =  –1100  2 = –12
 80 = 1010000 RC = Similarly RC = +12 because only difference
120 = 1111000 is sign bit.
a&b= 1010000 = 80+42=12 = z
RB = 0100 0010 0001 00000
char d  (a|b) + ‘–’
= Sign = (+)
 Bitwise| = (80|120) + 45 = Exponent = 132
 80 = 1010000 = +1.001 × 2132–127
120 = 1111000
= +1.001 × 25
a|b= 1111000 =120-45=75=K
= + 100100  = +36
Char e  (a ^ b) + ‘+’
So, false option is C = A + B
Bitwise^= (80 ^ 120) + 43
 a^b = 1010000 50. Which one of the following facilitates transfer of
1111000 bulk data from hard disk to main memory with
a^b = 0101000 =40+43=83 = S the highest throughput ?
print character = (z, K, S) (a) Programmed I/O transfer
(b) Polling based I/O transfer
49. Consider three floating point numbers A, B and
C stored in registers RA, RB and RC, respectively (c) Interrupt drive I/O transfer
as per IEEE-754 single precision floating point (d) DMA based I/O transfer
format. The 32-bit content stored in these Sol: (d)
registers (in hexadecimal form) are follows.

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 

For linked allocation, we need to access the (b) AX =  X


block from 1 to 50, new block access that should –9 –6 –2 –4  0  0 0
insert between 50 and 51 block, and access 51       
–8 –6 –3 –1  1  3
=
1
= 3    AX = 3X
block. So, the total access is 52. 20      
15 8 5 –3 9 –3
      
32 21 7 12  0  0  0 
50 51
(c) AX =  X
Total 52 access  –9 –6 –2 –4   1   7 
For contiguous allocation, we have 100 block, in     
 –8 –6 –3 –1   0   –5 
=  AX  X
contiguous allocation first we push the 100th  20 15 8 5   –1 12 
block to 101th block (we need two access), then     
we push 99th block to 100th block (we need two  32 21 7 12   0   25 
access again) and so on upto 51th block. Now, 51 (d) AX =  X
block is empty, then we push new block to 51
position list need one access). So, total access are  –9 –6 –2 –4   –1  –1
    
50 ×2 + 1 = 100 +1 = 101  –8 –6 –3 –1   1   1 
   20
=  AX = 1X
 For51 to 100 block  for new block 15 8 5  0   0 
    
Total required access are 101 + 52 = 153.  32 21 7 12   1   1 

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.

(d) Every access to R evicts Q from the cache. Sol: (a, b, c)

Sol: (a, c, d) Given language,

Cache Memory Size = 2 KB L1 = a n wa n |w  a,b *


Main Memory Size = 64 KB L 2 = wxw R |w,x  a,b *, w , x  0
Block Size = 64 B Regular expression can be written for the
language L1 and L2.
Cache Memory Size
Number of Lines = For L1,
Block Size
2K 211 (a + b)*
= = 6 = 25
64 2 For L2,
16 bit + +
a a + b a + b a + b b
tag Number of Word Hence, both language are regular. And regular
lines Offset language are context free.
5 bit 5 bit 6 bit
55. Consider the relational database with the
P:(A248)H 1010 0010 0100 1000; 9th block following four schemes and their respective
instances.
Q:(C284)H 1100 0010 1000 0100; 10th block
Student(sNo, sName, dNo) Dept(dNo, dName)
R:(CA8A)H 1100 1010 1000 1010; 10th block Course(cNo, cName, dNo) Register (sNo,
S:(A262)H 1010 0010 0110 0010; 9th block cNo)

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
ST S.val = T.val 
EXIST T  T1 %R T.val = T1.val  R .val 
(select cNo from Course where dNo = “D01” TR 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) ST 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” TR 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 ?

(a) L32 = 2, U 33 = 2, x1 = –1 (a) LR (1) parsing is sufficient for deterministic


context-free language.
1 1 (b) Symbol tale is accessed only during the
(b) L32 = – , U33 = – , x1 = 0
2 2 lexical analysis phase.
1 (c) Data flow analysis is necessary for run-time
(c) L32 = 2, U 33 = – , x1 = –1
2 memory management.
1 (d) The LAIR(1) parse for a grammar G cannot
(d) L 32 = – , U 33 = 3, x1 = –0 have reduce-order conflict if the LR(1) parser
2
for G does not have a reduce-reduce conflict.
Sol: (b)
Sol: (a)
Let take coefficient matrix.
We can create a LR parsser to pass a DCFL
1 1 –2 language. Sometime LR parser cannot parse
  context free language( CFL) because CFL are
A = 1 3 –1
2 1 –5 sometime inherently ambiguous and we cannot
 
design a LR parser for ambiguous grammar.
Perform row-column operation. So, LR(1) is sufficient for DCFL.
R 2  R 2 – R1 • Symbol table can be accessed in all phases
of compiler.
1 1 –2
  • Data flow analysis is necessary in code-
0 2 1  optimization.
2 1 –5
  • LALR may have reduce-reduce conflict even
R 3  R3 – 2R1 if CLR don’t have any RR conflict (conflict
arising due to merging of states where
1 1 –2 lookaheads are same).
 
0 2 1  A  .a A  .,b
0 –1 –1
  B  .b A  .,a

 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

(d) The best algorithm for the problem takes


  n 2  time in the worst case. T2 T2
Move first
T3 have
which have in degree=0
Sol: (a)
indegree=0
that is T1
Three pointers are required to reverse the linked T3 T4 T4
list.
T 4 have
indegree 0
So, in worst case   n  time required to reverse
T2
the linked list.

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

R1  x  R2  x  R3  x  R1  y W1  y  W2  x  W3  y R4  y  (d) R1 = 1011 and R2 = 1110


Sol: (c)
Which one of the following serial schedules is
conflict equivalent to S ? Given two four bit registers R1 and R2.
(a) R1 = 1001
(a) T3  T1  T4  T2
R2 = 1111
(b) T1  T4  T3  T2
R1 + R2 = 1 0 0 1
(c) T1  T3  T4  T2 1 1 1 1
1 0 0 0
(d) T4  T1  T3  T2
No overflow occurred, because sign bit is
Sol: (c) same for (R1 + R2).
Given schedule S with four transactions, (b) R1 = 0011

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

No overflow occurred, because sign bit is


30% 70%
same for (R1 + R2).
0 Stalls
62. A processor X1 operation at 2 GHz has a
80% 20%
standard 5-stage RISC instruction pipeline
having a base CPI (cycles per instruction) of 0 Stalls 2 Stalls
one without any pipeline hazards. For a given CPI = 1 +  0.3 × 0.2 × 2 
program P that has 30% branch instructions, = 1.12
control hazards incur 2 cycles stall for every Average instruction execution time
branch. A new version of the processor X2 = CPI × Cycle time
operating at same clock frequency has an
= 1.12 × 0.5 ns = 0.56 ns
additional branch predictor unit (BPU) that
completely eliminate stalls for correctly predicted 0.8
Speed up= = 1.42
branches. There is neither any savings nor any 0.56
additional stalls for wrong predictions. There
are no structural hazards and data hazards for 63. Consider a demand paging system with four page
frames (initially empty) and LRU page replace-
X1 and X2. If the BPU has a prediction accuracy
ment policy. For the following page reference
of 80%, the speed upto (rounded off to two
string.
decimal places) obtained by X 2 over X 1 in
7, 2,7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1
executing P is _____.
the page fault rate, defined as the ratio of
Sol: (1.42) number of page faults to the number of memory
Cycle time (tp) = 2 GHz = 0.5 nanoseconds accesses (rounded off to one decimal place_ is
_____.
K = 5, X1  without branch prediction.
Sol: (0.6)

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.

64. Consider the resolution of the domain name f(1) = 1


www.gate.org.in by a DNS resolver. Assume f(2) = f(2*1)=2f(1)–1=2–1=1 [f(2n) = 2f(n) –1]
that no resource records are cached anywhere
across the DNS servers and that iterative query f(3) = f(2*2+1)=2*f(1)+1=3 [f(2n+1) = 2(n)+1]
mechanism is used in the resolution. The f(4) = f(2*2) = 2f(2)–1 = 2*1–1=1
number of DNS query-response pairs involved
in completely resolving the domain name f(5) = f(2*2+1) = 2f(2)+1=2*1+1=3
is _____. f(6) = f(2*3)=2f(3)–1 = 2*3–1=5
Sol: (4) f(7) = f(2*3+1) = 2f(3)+1=7
Given domain name, f(8) = f(23) = f(2*4) = 2f(4)–1 = 2*1–1 = 1
www.gate.org.in f(9) = f(2*4+1) = 2f(4)+1 = 2*1+1 = 3
Iterative query mechanism is used in the f(10) = f(5*2) = 2f(5)–1 = 2*3–1 = 5
resolution,

f(20) = f(5*4) = f(10*2) = 2f(10)–1=2*5–1 = 9
Query
2 • Computation of f(2), f(4) and f(8) show that
in
1
3
f(2n) = 1 is correct.
www.gate.org.in
Root DNS Server
• Computation of f(3) and f(7) show that
4
8 f  2n – 1  = 2n – 1 is correct.
org.in
Local DNS
Server 5 • Computation of f(10) and f(20) show that
6 f  5.2n  = 2n+1 +1
TLD DNS Server
gate.org.in • Computation of f(5) and f(9) show that
7
f  2n +1  = 2n +1 is not correct.

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]

You might also like