CS Gate 2020 Final 1 PDF
CS Gate 2020 Final 1 PDF
CS Gate 2020 Final 1 PDF
GENERAL APTITUDE
1. The dawn of the 21st century witnessed the melting glaciers oscillating between giving too much and too
little to billions of people who depend on them for fresh water. The UN climate report estimates that
without deep cuts to ma-made emissions, at least 30% of the northern hemisphere’s surface permafrost
could melt by the end of the century. Given this situation of imminent global exodus of billions of
people displaced by rising seas, nation-states need to rethink their carbon footprint for political concerns,
if not for environmental ones.
Which one of the following statements can be inferred from the given passage?
(A) Nation-states do not have environmental concerns.
(B) Billions of people are responsible for man-made emissions.
(C) Billions of people are affected by melting glaciers.
(D) Nation-states are responsible for providing fresh water to billions of people.
Key: (C)
3. His knowledge of the subject was excellent but his classroom performance was ________.
(A) desirable (B) extremely poor (C) praiseworthy (D) good
Key: (B)
4. There are multiple routes to reach from node 1 to node 2, as shown in the network.
100
a c
100
200
200
300 200
1 b 2
0
d 200
0
100
100
e
f 100
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
The cost of travel on an edge between two nodes is given in rupees. Node ‘a’, ‘b’, ‘c’, ‘d’, ‘e’ and ‘f’ are
toll booths. The toll price at toll booths marked ‘a’ and ‘e’ is Rs. 200, and is Rs. 100 for the other toll
booths. Which is the cheapest route route from node 1 to node 2?
(A) 1-f-e-2 (B) 1-b-2 (C) 1-a-c-2 (D) 1-f-b-2
Key: (D)
Sol: From the given figure, the cheapest route from node 1 to node 2 is 1-f-b-2.
Toll price at a = 200
Tp = 100
100
a c
200 100
Tp = 100
300 200
1 b 2
200
0
100
e
f 100
Toll price at e = 200
Tp = 100
5. Raman is confident of speaking English _____ six months as he has been practising regularly _____ the
last three weeks.
(A) during, for (B) within, for (C) for, in (D) for, since
Key: (B)
6. The total revenue of a company during 2014-2018 is shown in the bar graph. If the total expenditure of
the company in each year is 500 million rupees, then the aggregated profit or loss (in percentage) on the
total expenditure of the company during 2014-2018 is __________.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
900
800
700
Revenue (In million rupees) 600
500
400
300
200
100
0
2014 2015 2016 2017 2018
Year
(A) 20% profit (B) 20% loss (C) 16.67 % loss (D) 16.67% profit
Key: (A)
Sol: From the chart;
Revenue of a company during 2014-2018 are 500, 700, 800, 600, 400.
Total revenue = 3000 million rupees
Total expenditure of the company during 2014-2018.
= 5 × 500 million = 2500million
3000 − 2500 500
Profit % = 100 = 100 = 20%
2500 2500
7. Two straight lines are drawn perpendicular to each other in X-Y plane. If and are the acute angles
the straight lines make with the X-axis, then + is ________.
(A) 120° (B) 60° (C) 90° (D) 180°
Key: (C)
8. Goods and Services Tax (GST) is an indirect tax introduced in India in 2017 that is imposed on the
supply of goods and services, and it subsumes all indirect taxes except few. It is a destination-based tax
imposed on goods and services used, and it is not imposed at the point of origin from where goods come.
GST also has a few components specific to state governments, central government and Union Territories
(UTs).
Which one of the following statements can be inferred from the given passage?
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
31 33 35
32 34
Q=3 =9
S = 34 = 81
Q + S = 90
10. The figure below shows an annular right with outer and inner radii as b and a, respectively. The annular
space has been painted in the form of blue colour circles touching the outer and inner periphery of
annular space. If maximum n number of circles can be painted, then the unpainted area available in
annual space is ___________.
(A) ( b 2 − a 2 ) − n ( b − a ) (B) ( b 2 − a 2 ) + n ( b − a )
2 2
2 2
(C) ( b2 − a 2 ) − ( b − a ) (D) ( b2 − a 2 ) + ( b − a )
n n
4 4
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Key: (C)
Sol: Given figure is
(b − a )
2
b−a
2
(b − a)
2
n ( b − a )
2
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
b
a
S B
2
1
d b
BUS
TEMP1
MAR MDR IR PC R0
R1
TEMP2
ALU
To Memory
R7
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Consider an instruction: R0 R1 + R2. The following steps are used to execute it over the given data
path. Assume that PC is incremented appropriately. The subscripts r and w indicate read and write
operations, respectively.
1. R2r ,TEMP1r ,ALUadd ,TEMP2w
2. R1r ,TEMP1w
3. PCr ,MAR w ,MEMr
4. TEMP2r ,R0w
5. MDR r , IR w
Which one of the following is the correct order of execution of the above steps?
(A) 3, 5, 2, 1, 4 (B) 2, 1, 4, 5, 3 (C) 3, 5, 1, 2, 4 (D) 1, 2, 4, 3, 5
Key: (A)
Sol: The correct order of execution:
3. PCr , MAR W, MEM r
5. MDR r , IR W
2. R1r , TEMP1W
1. R2r , TEMP1r, ALUadd , TEMP2W
4. TEMP2r , ROW .
3. Consider allocation of memory to a new process. Assume that one of the existing holes in the memory
will exactly fit the process’s memory requirement. Hence, a new hole of smaller size will be created if
allocation is made in any of the existing holes. Which one of the following statements is TRUE?
(A) The hole created by next fit is never larger than the hole created by best fit.
(B) The hole created by best fit is never larger than the hole created by first fit.
(C) The hole created by first fit is always large than the hole created by next fit.
(D) The hole created by worst fit is always larger than the hole created by first fit.
Key: (B)
Sol: Given that, “none of the existing holes in the memory will exactly fit the process’s memory requirement.
Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes”.
As best fit always chooses “the smallest hole that is big enough”. The hole created by best fit is never
larger than the hole created by first fit. Hence option (B) is correct.
Option C and D are not “always” possible.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
4. Which one of the following regular expressions represents the set of all binary strings with an odd
number of 1’s?
(A) ((0 +1)*1(0+1)*1)*10* (B) (0*10*10*)*10*
(C) 10*(0*10*10*)* (D) (0*10*10*)*0*1
Key: (B)
Sol: (A) never generate 10.
(B) never generate 01.
(C) never generate 10.
(D) generate all binary string with odd number of 1’s.
Then T(n) is
(A) ( log ab n ) (B) ( log a log b n )
Key: (B)
Sol: T ( n ) = T ( n1 a ) + 1
( )+2
T ( n ) = T n1 a
2
T (n) = T (n ) + 3 1 a3
T ( n ) = T n1 a( )+k k
Let, n1 a = b a k = log b n
k
k = log a log b n
T ( n ) = T ( b ) + log a log b n
T ( n ) = 1 + log a log b n
I. L is deterministic context-free.
II. L is context-free but not deterministic context-free.
III. L is not LL(k) for any k.
Which of the above statements is/are TRUE?
(A) II only (B) I only (C) III only (D) I and III only
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Key: (D)
Sol: L is DCFL because we can design DPDA for L.
The grammar for L is
S → aSb A
A → aA
8. A multiplexer is placed between a group of 32 registers and an accumulator to regulate data movement
such that at any given point in time the content of only one register will move to the accumulator. The
minimum number of select lines needed for the multiplexer is _________.
Key: (5)
1
Sol:
2
3
4 32 1
1
Registers 5 MUX Accumlator
6
32
5 1
selection 2
3
lines
4
required 5
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
III. x3 + 1
Which of the above function is/are increasing everywhere in [0, 1]?
(A) I and III only (B) III only (C) II and III only (D) II only
Key: (B)
Sol: I. e − x is growth decreasing function.
10. A direct mapped cache memory of 1 MB has a block size of 256 bytes. The cache has an access time of
3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the
main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory
access time in ns (round off to 1 decimal place) is _______.
Key: (13.32)
Sol: Block size = 256 byte, word size = 64 bit = 8byte.
So, we need to send 32 words (i.e. one block) from memory when there is miss in cache.
EAT = ( 0.94 3 + 0.06 (1 20 + 31 5) ) ns
= 2.88 + 10.5 = 13.32ns
11. Let G be a group of 35 elements. Then the largest possible size of a subgroup of G other than G itself is
__________.
Key: (7)
Sol: Order of given group =35 and the order of sub group always divides the order of group.
So possible order of subgroup is 1, 5, 7, 35 it self group.
So largest proper. sub group is “7”
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
L2 = a n b n n 0 CF.L
L1UL2 = a b* Regular
So (I) is false.
(II) is also false because regular languages are not closed under infinite inter section.
14. Which of the following is used to represent the supporting many-one relationships of a weak entity set in
an entity-relationship diagram?
(A) Ovals that contain underlined identifiers
(B) Rectangles with double/bold border
(C) Diamonds with double/bold border
(D) Ovals with double/bold border
Key: (C)
Sol: Total
participation
E1 E2
identifying weak
Relation entity
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
15. If there are m input lines and n output lines for a decoder that is used to uniquely address a byte
addressable 1KB RAM, then the minimum value of m + n is ________.
Key: (1034)
Sol: We require 210 outputs to map 1KB RAM.
So, we need 10 210 decoder
x = 10 & y = 210
x + y = 1034.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Sno Sname
S1 RF
S2 BF
S3 PF
S3 PF
Total 4 tuple print.
The number of rows returned by the above SQL query is 4.
17. What is the worst case time complexity of inserting n2 elements into an AVL-tree with n elements
initially?
(A) ( n 3 ) (B) ( n 2 log n ) (C) ( n 2 ) (D) ( n 4 )
Key: (B)
Sol: O ( n 2 log n )
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
18. The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19.
Which one of the following is the postorder traversal of the tree?
(A) 10, 11, 12, 15, 16, 18, 19, 20 (B) 20, 19, 18, 16, 15, 12, 11, 10
(C) 19, 16, 18, 20, 11, 12, 10, 15 (D) 11, 12, 10, 16, 19, 18, 20, 15
Key: (D)
Sol: Pre order 15, 10, 12, 11, 20, 18, 16, 19.
So, BST is
15
10 20
12 18
11 16 19
19. What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list
needs to be maintained in sorted order?
(A) ( n ) (B) (1) (C) ( n 2 ) (D) ( n log n )
Key: (D)
Sol: 1st sort the n elements using merge sort so the complexity merge sort in worst case is ( n log n )
Now insert the element in link list using insert at first so time required for insertion =
Total time = ( n log n ) + ( n ) = ( n log n )
20. Let R be the set of all binary relations on the set [1, 2, 3]. Suppose a relation is chosen from R at
random. The probability that the chosen relation is reflexive (round off to 3 decimal places) is ________.
Key: (0.125)
Sol: A 1, 2,3
−3
Number of reflexive relation on A = 23 = 26 = 64
2
64
P reflexive = = 0.125
512
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
23. Consider the following statements about process state transitions for a system using preemptive
scheduling.
I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Dispatched Scheduled
Admitted
Blocked
So,
A process can make a transition from ready state to running state.
A process can make a transition from running state to ready state.
A process can make a transition from blocked state to ready state.
But a process cannot make a transition from blocked state to running state.
Hence, option (D) is correct.
24. Assume that you have made a request for a web page through your web browser to a web server.
Initially the browser cache is empty. Further, the browser is configured to send HTTP requests in non-
persistent mode. The web pages contains text an five very small images. The minimum number of TCP
connections required to display the web page completely in your browser is ___________.
Key: (6)
Sol: HTTP can use the following 2 types of connections. They are
(i) Persistant
(ii) Non Persistant
(i) In HTTP with non persistant connection, each TCP connection transports exactly one
request/response message.
(ii) In HTTP with persistant correction, each TCP connection load and receive multiple
requests/responses. By default, HTTP uses persistant connections rather than non persistant.
(iii) As per question, web page with non persistant HTTP connection, has one text and 5 small size
images. So, for text image one TCP connection is required and for 5 small images, 5 TCP
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
connections are required. Hence, to transfer one text and 5 small size images, the number of TCP
connections required is 6.
25. Consider a double hashing scheme in which the primary has function is h1 ( k ) = k mod 23, and the
secondary hash function is h 2 ( k ) = 1 + ( k mod19 ) . Assume that the table size is 23. Then the address
returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key
value k = 90 is __________.
Key: (13)
Sol: K=90
Using first Hash function
h1 ( 90) = 90 mod 23
h1 ( 90) = 21
If there is collision at probe O, then search for prob 1.
So, pass key 90 by Hash function (2)
h 2 ( 90 ) = 1 + ( 90 mod 19 )
= 1 + 14 15
So address is 21 + 15 = 36
The address returned by probe 1 in the probe sequence for key value k = 90 is 36 mod 23 = 13
26. Which one of the following predicate formulae is NOT logically valid?
Note that W is a predicate formula without any free occurrence of x.
Key: (B)
Sol: x ( p ( x ) → W ) = xp ( x ) → W
Wrong because,
x ( px → W )
x ( ~ p ( x ) vW )
~ ( x p ( x ) ) vW
x p ( x ) → W
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
27. A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I –type
and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value.
Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type
opcodes, then the maximum number of distinct R-type opcodes is ________.
Key: (14)
Sol: I-type
6 6 6
Opcodes Reg IV
16 bit
R-type
16 bit
28. An organization requires a range of IP addresses to assign one to each of its 1500 computers. The
organization has approached an Internet Service Provider (ISP) for this task. The ISP uses CIDR and
serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an
address space to the organization which will minimize the number of routing entries in the ISP’s router
using route aggregation. Which of the following address spaces are potential candidates from which the
ISP can allot one to the organization?
I. 202.61.84.0/21
II. 202.61.104.0/21
III. 202.61.64.0/21
IV. 202.61.144.0/21
(A) I and II only (B) I and IV only (C) III and IV only (D) II and III only
Key: (D)
Sol: As per question, Organization requires a range of IP addresses to assign one to each of its 1500
computers.
232−n = 1500 211 n = 21
Given CIDR based address is 202.61.0.0/17
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
202.61.8.0 | 21 to 202.61.15.255| 21
202.61.16.0 | 21 to 202.61.23.255| 21
29. Consider a relational table R that is in 3NF, but not in BCNF. Which of the following statements is
TRUE?
(A) R has a nontrivial functional dependency X → A, Where X is not a superkey and A is a non-prime
attribute and X is not a proper subset of any key.
(B) R has a nontrivial functional dependency X → A, where X is not a superkey and A is a non-prime
attribute and X is a proper subset of some key.
(C) R has a nontrivial functional dependency X → A, where X is not a superkey and A is a prime
attribute.
(D) A cell in R holds a set instead of an atomic value.
Key: (C)
Sol: If → and is prime attribute then relation is in 3NF but not in BCNF.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Key: (6)
Sol:
b b b b
a a a a b
a
a
b
31. Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block
size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that
the database has one million records. Also assume that no node of the B+ tree and no records are present
initially in main memory. Consider that each record fits into one disk block. The minimum number of
disk accesses required to retrieve any record in the database is ____________.
Key: (4)
Sol: Block size = 4KB
Key size = 12byte
block point er size = 8byte
Order of B+ tree = n
( n − 1) key + n block pointer B.S
( n − 1) 12 + n 8 4096
20n 4108
n 205.4
n = 205
To represent index of 1 million records we need B+ tree of height 3 ( if n = 205 ) .
So, to access record we should go up to leaf node pulse one block access to read data.
Hence, 3H=4 block access.
32. Consider three registers R1, R2 and R3 that store numbers in IEEE-754 single precision floating point
format. Assume that R1 and R2 contain the values (in hexadecimal notation) 0×42200000 and
0×C1200000, respectively.
R1
If R3 = , what is the value stored in R3?
R2
(A) 0×C0800000 (B) 0×40800000 (C) 0×83400000 (D) 0×C8500000
Key: (A)
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Sol:
1 8 23
sign exponent Mantissa
4 2 2 0 0 0 0 0
C 1 2 0 00 0 0
R 3 1 10000001 0000.....0
C 0 8 0 0 000
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the following schedules is
conflict equivalent to the above schedule?
(A)
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
(B)
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
(C)
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
(D)
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
Key: (C)
Sol: Precedence graph for schedule in question is:
C
T1 T2
D
Precedence graph for option (C) is
C
T1 T2
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
34. Consider a paging system that uses 1-level page table residing in main memory and a TLB for address
translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer
to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume
that for 20% of the total page faults, a dirty page has to be written back to back to disk before the
required page is read in from disk. TLB update time is negligible. The average memory access time in ns
(round off to 1 decimal places) is ___________.
Key: (154.5)
Sol: EMAT = 0.95 ( 20 + 100 ) + 0.05 ( 0.9 ( 20 + 100 + 100 ) )
+0.1 ( 0.2 ( 20 + 100 + 5000 + 5000 ) + 0.8 ( 20 + 100 + 5000 ) ) = 154.5ns
35. Let A and B two n × n matrices over real numbers. Let rank(M) and det (M) denote the rank and
determinant of a matrix M, respectively. Consider the following statements.
I. rank(AB) = rank (A) rank (B)
II. det(AB) = det(A) det(B)
III. rank(A + B) rank (A) + rank (B)
IV. det(A + B) det(A) + det(B)
Which of the above statements are TRUE?
(A) III and IV only (B) II and III only (C) I and II only (D) I and IV only
Key: (B)
Sol: From determinant properties; we have
det ( AB ) = det ( A ) .det ( B ) if A, B are both square matrices of order ‘n’.
So, II is correct.
From rank properties, we have
rank ( A + B ) rank ( A ) + rank ( B )
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
i=5
Again call
40
9 same defiraiton
i = 5 + fun1( 4 ) ;
so + +1 change value of i = 5
fun2 ( 3) ;
Soi = 14
37. The number of permutations of the characters in LILAC so that no character appears in its original
position, if the two L’s are indistinguishable, is ___________.
Key: (12)
Sol: Number of derangements
L’s can be arranged in 3 C2 ways.
For each of these cases remaining 3 letters can be deranged in 2 * 2! ways
So total derangements = 3 C2 * 2* 2! = 12
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
L1 = wxyx | w, x, y ( 0 + 1)
+
L2 = xy | x, y ( a + b ) *, x = y , x y
L1 = ( 0 + 1) 0 ( 0 + 1) 0 ( 0 + 1) + ( 0 + 1) 1( 0 + 1) 1( 0 + 1)
+ + + + + +
So L1 is regular.
We need to remember length of x & y so we need memory (stack) so it is not regular but CFL.
39. Consider the productions A → PQ and A → XY. Each of the five non-terminals A, P, Q, X and Y has
two attributes: s is a synthesized attribute, and i is an inherited attribute. Consider the following rules.
Rule1: P.i = A.i + 2Q.i = P.i+ A.i and A.s = P.s+ Q.s
Rule 2 : X.i = A.i + Y.s and Y.i = X.s+ A.i
Which one of the following is TRUE?
(A) Both Rule 1 and Rule 2 are L-attributed.
(B) Only Rule 1 is L-attributed.
(C) Only Rule 2 is L-attributed.
(D) Neither Rule 1 nor Rule 2 is L-attributed.
Key: (B)
Sol: Only Rule 1 is L attributed
Rule1: P.i = A.i + 2,
Q.i = p.i + A.i L Attributed
A.s = p.s + Q.s
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Which one of the options completes the following sentence so that it is TRUE?
“The shortest paths in G under w are shortest paths under w ' too, ________”.
(A) if and only if f(u) is the distance from s to u in the graph obtained by adding a new vertex s to G
and edges of zero weight from s to every vertex of G
(B) for every f : V →
(C) if and only if u V, f(u) is positive
(D) if and only if u V, f(u) is negative
Key: (B)
Sol: Option A is false because of "if and only if" point. Condition is option A is sufficient but not necessary
condition for shortest path not to change.
Option B is correct because in every path, all the f values of intermediate vertices will cancel each other
in the summation of edges on that path except for first (source) and last (destination) vertices. In every
path from vertex u to v, f(u) - f(v) will be added to the that path length. So, the shortest path will not
change.
41. Let G = (V, E) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G
maintained using adjacency lists. Suppose a new weighted edge ( u, v ) V V is added to G. The
worstcase time complexity of determining if T is still an MST of the resultant graph is
Key: (C)
Sol: in MST , we have n vertices and n-1 edges so when we add new edge in graph G, we need to check
whether that new edge will be present in modified MST or not, and for that edge to occur in modified
MST, that edge should make a cycle with the original edges of MST and in that cycle that edge must not
be largest weight. Since we are checking for cycles in MST and not in the graph G, time taken will be
V+E where E is V-1. So final time is order of V only.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
42. Consider a TCP connection between a client and a server with the following specification the round trip
time is 6 ms, the size of the receiver advertised window is 50 KB, slow-start threshold at the client is 32
KB, and the maximum segment size is 2 KB. The connection is established at time t = 0. Assume that
there are no timeouts and errors during transmission. Then the size of the congestion window (in KB) at
time t + 60 ms after all acknowledgements are processed is _________.
Key: (44)
Sol: Given that MSS = 2kB
Threshold = 32 kB
t=0
RTT1 0 th round → 1 MSS 1 2KB = 2KB
1st round → 2 MSS 2 2KB = 4 KB
RTT2
Slow start phase 2nd round → 4 MSS 4 2KB = 8KB
RTT3
3rd round → 8 MSS 8 2KB = 16 KB
RTT4 4 th round → 16 MSS 16 2KB = 32KB
Reached to composition threshold
RTT5
43. A computer system with a word length of 32 bits has a 16 MB byte-addressable main memory and a 64
KB, 4-way set associative cache memory with a block size of 256 bytes. Consider the following four
physical addresses represented in hexadecimal notation.
A1 = 0 42C8A4
A2 = 0 546888
A3 = 0 6A289C
A4 = 0 5E4880
Which one of the following is TRUE?
(A) A1 and A4 are mapped to different cache sets.
(B) A2 and A3 are mapped to the same cache set.
(C) A3 and A4 are mapped to the same cache set.
(D) A1 and A3 are mapped to the same cache set.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Key: (B)
Sol: 18 16 8
Tag set offset
32 bit
cache size
Set Number =
Block size Number of ways
64KB
=
256 4
= 8 2 = 26 set No.
216
2 2
Tag = 32 − ( 6 + 8 )
Now A1 = 42C8A4
= 0100 0010 1100 100010100100
Set No
A 2 = 546888
= 0101 0100 0110 1000 1000 1000
Set No
Same
A3 = 6A289C SetNo
= 011 01010 0010 1000 1001 1100
So A2 & A3 set Numbers are same.
44. Which of the following languages are undecidable? Note that M indicates encoding of the Turing
machine M.
L1 = M | L ( M ) =
L2 = M, w,q | M on input w reaches state q in exactly 100 steps
L3 = M | L ( M ) is not recursive
L4 = M | L ( M ) contains at least 21 members
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Key: (A)
Sol: L1 : Emptiness problem of TM is undividable.
L2 : Decidable after 100 steps TM will halt for both the valid/invalid input.
L3 : It is undecidable.
L3 : Membership problem of TM is undecidable.
45. In a balanced binary search tree with n elements, what is the worst case time complexity of reporting all
elementsin range [a, b]? Assume that the number of reported elements is k.
(A) ( k log n ) (B) ( log n + k ) (C) ( n log k ) (D) ( log n )
Key: (B)
Sol:
25
22 28
21 23 27 29
Let a = 21 and b = 29
So to find 21, O(log n) time required to find 29, O (long n) time required and in the range there are K
elements. So it can be found in K time by inorder travers.
So total time = O(2 logn +K) = O(logn + K)
For n 2, let a 0,1 be a non-zero vector. Suppose that x is chosen uniformly at random from
n
46.
0,1
n n
. Then, the probability that a x i is an odd number is __________.
i =1 i
Key: (0.5)
a1 x1
a x
Sol: a= 2
x = 2
a n xn
a i = 0 or 1
x i = 0 or 1
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
n
a x
i =1
i i values lies between 0 to n.
ai xi 0 1 2 .... n
f av n C0 n C1 n C2 .... n Cn
n
n C1 + n C3 + ... 2n −1 1
= = = = 0.5
2n 2n 2
Key: (81)
Sol: PP ( 3, 4 )
tot = 1, ex = 3;
len = tob ( 4, arr ) ;
for ( i = 0; 4 0, b 0 : i++ )
1 1 0
arr 0 arr 1 arr 2
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
len = 3
for ( i = 0; i 3;i + + )
{
if ( arr i == 1)
tot = tot * x;
= x x;
}
return ( tot ) ;
}
Final return value is 81.
48. Each of a set of n processes executes the following code using two semaphores a and b initialized to 1
and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE
SECTION P.
CODE SECTION P
Wait (a); count = count + 1;
if (count ==n) signal (b);
signal (a); wait (b); signal (b);
CODE SECTION Q
What does the code achieve?
(A) It ensures that at most n–1 processes are in CODE SECTION P at any time.
(B) It ensures that at most two processes are in CODE SECTION Q at any time.
(C) It ensures that no process executes CODE SECTION Q before every process has finished CODE
SECTION P.
(D) It ensures that all processes execute CODE SECTION P mutually exclusively.
Key: (C)
Sol: Initial values,
Count = 0; a = 1; b = 0; Assume that, n = 4 P1 P2 P3 P4
P1 P2
Count; a = 1; b = 0; n = 4 Count = 1; a = 1; b= 0; n = 4
Code section P Code Section P
Wait (a); //a = 0 Wait (a); //a = 0
Count = count +1; //count = 1 Count = count + 1; //count = 0
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
P4 P3
Count 3; a = 1; b = 0; n = 4 Count =2 ; a = 1; b = 0; n = 4
Code section P Code section P
Wait (a); //a = 0 Wait (a); //a = 0
Count = count +1; //count = 4 Count = count +1; //count = 3
If (count = n) condition true If (count = n) //condition is false
{signal (b);}// b = 1 {signal (b);} doesn’t execute
Wait (b); //b = 0 Signal (a); //a = 1
Signal (b); //b = 1 Wait (b); P3 struck here
Code section Q Signal (b);
First P4 can complete both code section P and Q. Later remaining 3 processes can complete code section
P and Q.
It is clear that no process executes code section Q before every process has finished code section P .
Hence option C is correct.
49. Consider the array representation of binary min-heap containing 1023 elements.
The minimum number of comparisons required to find the maximum in the heap is _________.
Key: (511)
Sol: Number of elements in Binary min heap = 1023, so maximum element should be at leaf level.
n
So total number of leaf node for n node binary tree = = 512
2
So, total comparison = 511 (Using bubble sort).
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
50.
Consider a graph G = (V, E), where V = v1 , v 2 ,..., v100 , E = ( vi , v j ) |1 i j 100 , and weight of the
edge ( vi , v j ) is i − j . The weight of minimum spanning tree of G is _________.
Key: (99)
Sol: The spanning contain 99 edge and 100 vertices and weight of each edge is on
1
V1 V2
1
1
V3 V4
V5 1
V6
V99 V100
51. Consider the following five disk access requests of the form (request id, cylinder number) that are
present in the disk scheduler queue at a given time.
(P, 155), (Q, 85), (R, 110), (S, 30), (T, 115)
Assume the head is positioned at cylindrical 100. The scheduler follows shortestSeek Time First
scheduling to service the requests.
Which one of the following statements is FALSE?
(A) Q is serviced after S, but before T.
(B) The head reverses its direction of movement between servicing of Q and P.
(C) R is serviced before P.
(D) T is serviced before P.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Key: (A)
Sol:
Initial
Head position
S Q R T P
30 85 100 110 115 155
According to above servicing order of cylinders using SSTF, option A is false, which is the correct
answer.
52. Consider a non-pipelined processor operating at 2.5 GHz. It takes 5 clock cycles to complete an
instruction. You are going to make a 5-stage pipeline out of this processor. Overheads associated with
pipelining force you to operate the pipelined processor at 2 GHz. In a given program, assume that 30%
are memory instructions, 60% are ALU instructions and the rest are branch instructions. 5% of the
memory instructions cause stalls of 50 clock cycles each due to cache misses and 50% of the branch
instructions cause stalls of 2 cycles each. Assume that there are no stalls associated with the execution of
ALU instructions. For this program, the speedup achieved by the pipelined processor over the non-
pipelined processor (round off to 2 decimal places) is __________.
Key: (2.16)
1
Sol: For non-pipeline t n = 5CC = 5 n sec
2.5
t n = 2n sec
For pipeline:-
Average clock cycle/Instn is
Program
60%
30% ( 0stall ) 10%
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
Average CC Inst n = 0.3* 0.05* ( 50 + 1) + 0.3 0.95 1 + 0.6 *1 + 0.1* 0.5* (1 + 2 ) + 0.1* 0.5*1 = 1.85 CC
1
So, time = 1.85* n sec
2
t p = 0.925 n sec
tn 2
Speed up = = 2.16
t p 0.925
a
z
Which one of the following minterm lists represents the circuit given above?
(A) z = (1, 4,5,6,7 ) (B) z = ( 2,3,5 )
Key: (A)
Sol:
a
a + bc
b
b
c bc
f = a + bc bc
a bc bc bc bc
(1,4,5,7,6 )
a 0 1 3 2
1
a 1 1 1 7 1
4 5 6
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
54. Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling
algorithms Shortest Job First (SJF) and Round Robin (RR). For RR. Assume that the processes are
scheduled in the order P1 , P2 , P3 , P4 .
Processes P1 P2 P3 P4
If the time quantum for RR is 4 ms, then the absolute value of the difference between the average
turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is __________.
Key: (5.25)
Sol: Non preemptive SJF
PID AT BT CT TAT
P1 0 8 21 21
P2 0 7 13 13
P3 0 2 2 2
P4 0 4 6 6
Gantt chart:
P3 P4 P2 P1
0 2 6 13 21
P1 − 8 P1 − 8 P1 − 8 P1 − 8
P2 − 7 P2 − 7 P2 − 7
P3 − 2 P4 − 4
P4 − 4
21 + 13 + 2 + 6 42
Average TAT = = = 10.5
4 4
Round Robin with T. Q = 4
PID AT BT CT TAT
P1 0 8 18 18
P2 0 7 21 21
P3 0 2 10 10
P4 0 4 14 14
P1 P2 P3 P4 P1 P2
0 4 8 10 14 18 21
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.
|CS-Gate-2020|
18 + 21 + 10 + 14 63
Average TAT = = = 15.75
4 4
Difference = 15.75 − 10.50 = 5.25
55. Graph G is obtained by adding vertex s to K 3.4 and making s adjacent to every vertex of K3,4 . The
minimum number of colours required to edge-colour G is _________.
Key: (7)
Sol:
7
5
2
5
1
2 4
3
3
1
4 6
6 5
2
5 4
7 − colours required.
© All rights reserved by Thinkcell Learning Solutions Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission.