Professional Documents
Culture Documents
Grand Test 2
Grand Test 2
+91 844-844-0102 gatecse@appliedroots.com Importance of the GATE exam PRACTICE TESTS My Account Logout
Solution: (A)
Merge sort and Radix sort required additional memory so they are not inplace sorting algorithms.
C Insertion Sort
Solution: (D)
Merge sort and Radix sort required additional memory so they are not inplace sorting algorithms.
D Correct Option
Solution: (D)
https://gate.appliedroots.com/report?id=173769 1/39
5/15/2021 GATE CS Applied Course
A 1
Solution: (B)
For the given function f, the boolean expression formed will be:
=> X’Y’Z’ + X’Y’Z + XY’Z’ + XY’Z + XYZ’ + XYZ
=> X’Y’(Z’ + Z) + XY’(Z’ + Z) + XY(Z’ + Z)
=> X’Y’ + XY’ + XY
=> X’Y’ + X (Y’ + Y)
=> X’Y’ + X
=> (X’ + X)(X + Y’)
=> X + Y’
Hence, there are 2 literals in the minimal expression.
C 3
D 4
Correct Answer
Solution: ()
For the given circuit:
S1 = A . 0 = 0
S2 = B + 1
Therefore, F will be:
F = S1’S0’ . I0 + S1’S0. I1 + S1S0’ . I2 + S1S0 . I3
=> 1. 0. A + 1 . 1. 0 + 0. 0. B + 0 . 1. 1
=> 0
https://gate.appliedroots.com/report?id=173769 2/39
5/15/2021 GATE CS Applied Course
C each tuple in A is related to zero, one or more tuples in B. Your answer is Wrong
Solution: (D)
A foreign key is defined as an attribute or set of attributes in a relation whose value matches a primary key in another relation. Here A is the
referencing relation and B is the referenced relation. So a single tuple in A can refer to zero(because a foreign key can take NULL values) or one of the
relation B.
Solution: (D)
A A table of columns with one row with the value (NULL, NULL)
B A table of 2 columns with one row with the value (NULL, INF)
Solution: (C)
Since, the relation R is empty, therefore, it will not return any NULL values. The resultant relation will have 2 columns and 0 tuples.
D An error message
https://gate.appliedroots.com/report?id=173769 3/39
5/15/2021 GATE CS Applied Course
Solution: (A)
Since each character has to be either pushed onto the stack or popped or ignored we are doing a constant amount of work for each character hence the
total time required is O(n).
A 4
C 8 Correct Option
Solution: (C)
D 16
A 001111, 001111
https://gate.appliedroots.com/report?id=173769 4/39
5/15/2021 GATE CS Applied Course
Solution: (B)
182 binary equivalent is
000000 001011 0110
O set is 0110 (0-3)
Index bits are 001011 (4-9)
TAG bits are 000000 (10-15)
190 binary equivalent is
000000 001011 1110
O set is 1110 (0-3)
Index bits are 001011 (4-9)
TAG bits are 000000 (10-15)
C 001011, 001110
D 001111, 001011
A 2 0
B 0 2 Correct Option
Solution: (B)
Union declares the variable of maximum size.
So the 2 bytes of memory will be declared here.
Var.x = 512
X is assigned with 512.
512 = 00000010 00000000
Char variable is also using the same memory in the union.
So var.y[0] = 00000000 = 0
var.y[1] = 00000010 = 2
C 512 512
D 512 garbage
A Local Optimization
B Loop Optimization
https://gate.appliedroots.com/report?id=173769 5/39
5/15/2021 GATE CS Applied Course
Solution: (C)
Expressions with constant operands can be evaluated at compile time, thus improving run-time performance and reducing code size by avoiding
evaluation at compile-time.
D Strength Reduction
Solution: (C)
D Correct Option
Solution: (D)
Solution: (A)
https://gate.appliedroots.com/report?id=173769 6/39
5/15/2021 GATE CS Applied Course
Solution: (1)
Solution: (B)
Whether or not multiple threads improve performance depends largely on whether the work in a program can be parallelized. Programs that perform
the same operation across alargeset of data (for example, matrix arithmetic) can be easily parallelized and therefore will perform better with multiple
threads. Programs that are largely sequential (for example,a program reading the contents of a file in order) would not run faster with multiple
threads
C Both S1 and S2
Solution: (A)
Vectored interrupts are achieved by assigning each interrupting device a unique code, typically four to eight bits in length. When a device interrupts, it
sends its unique code over the data bus to the processor, telling the processor which interrupt service routine to execute.
B Non-vectored Interrupt
C Priority Interrupt
https://gate.appliedroots.com/report?id=173769 7/39
5/15/2021 GATE CS Applied Course
Solution: (B)
Here we are only asking the time required for packet to reach Y.
Total time = Tt + Tp
Tt = 8 D / B
Tp = L / S
Total time = 8D/B + L/S
D None of these
A 1/3
Solution: (C)
D 2/3
Assuming that computes take 1 cycle, loads and store instructions take 2 cycles, and branches take 3 cycles, find the execution time (in ns) of this program on
a 3 GHz MIPS processor.
A 193
Solution: (B)
https://gate.appliedroots.com/report?id=173769 8/39
5/15/2021 GATE CS Applied Course
C 617
D 766
Correct Answer
Solution: (2150)
The starting address for the array is 2000 and at the ith row we have i elements and the total number elements upto the 9th row are
20+19+18+17+16+15+14+13+12 and in the 10th row we are interested in the address of the 7th element.
Address of (10, 7)=2000+(20+19+18+17+16+15+14+13+12+ 7) -1=2150
Solution: (16)
Correct Answer
Solution: (5)
Correct Answer
https://gate.appliedroots.com/report?id=173769 9/39
5/15/2021 GATE CS Applied Course
Solution: (32)
A Computer PGogrammRng
Solution: (B)
C Computer Programming
https://gate.appliedroots.com/report?id=173769 10/39
5/15/2021 GATE CS Applied Course
Solution: (A)
7, 6, 10, 8, 4, 8, 7 is not valid because 8 is present is the le sub tree of 7(root).
2, 0, 10, -5, 1, 7,9 is not valid because 9 is present in the right sub tree of 10.
3, 4, 10, 12, 7, 8, 12 is not valid because 4 is present in the right sub tree of 3(root).
4, 1, 8, -3, 3, 5, 6 is not valid because 5 is the le child of 8, and 6 is the right child of 8.
Solution: (B)
7, 6, 10, 8, 4, 8, 7 is not valid because 8 is present is the le sub tree of 7(root).
2, 0, 10, -5, 1, 7,9 is not valid because 9 is present in the right sub tree of 10.
3, 4, 10, 12, 7, 8, 12 is not valid because 4 is present in the right sub tree of 3(root).
4, 1, 8, -3, 3, 5, 6 is not valid because 5 is the le child of 8, and 6 is the right child of 8.
Solution: (C)
7, 6, 10, 8, 4, 8, 7 is not valid because 8 is present is the le sub tree of 7(root).
2, 0, 10, -5, 1, 7,9 is not valid because 9 is present in the right sub tree of 10.
3, 4, 10, 12, 7, 8, 12 is not valid because 4 is present in the right sub tree of 3(root).
4, 1, 8, -3, 3, 5, 6 is not valid because 5 is the le child of 8, and 6 is the right child of 8.
Solution: (D)
7, 6, 10, 8, 4, 8, 7 is not valid because 8 is present is the le sub tree of 7(root).
2, 0, 10, -5, 1, 7,9 is not valid because 9 is present in the right sub tree of 10.
3, 4, 10, 12, 7, 8, 12 is not valid because 4 is present in the right sub tree of 3(root).
4, 1, 8, -3, 3, 5, 6 is not valid because 5 is the le child of 8, and 6 is the right child of 8.
A 1
B 2 Correct Option
Solution: (B)
C= capacity
M= Max output rate
S= Max burst time
C + ?S = MS
(10 * 10^6 * 8) + (12 * 10^6 * 2 ^3)S = (20 * 10^6 * 2 ^3)S
S = 1.25 sec
So 1.25 sec we transfer with the full rate
1 sec = 20 MB
1.25 sec = 1.25 * 20 MB = 25 MB transferred
Rest of 5 MB will transfer at 12 MBPS
1 sec = 12 MB
5 MB = (1 / 12) * 5 = 0.416 sec
Total time= 1.25 + 0.416 = 1.66 sec
D 4
https://gate.appliedroots.com/report?id=173769 11/39
5/15/2021 GATE CS Applied Course
Consider the following table which contains the characters and their frequency in which they occur in a message the number of characters required for the
following message if Hu man Encoding is used what is the average length of a character in bits_____
Correct Answer
Solution: (2.25)
Solution: (2000)
Bandwidth = 10 ^9 bits/ sec.
1 sec = 10 ^9 bits can be send
In Round trip time = 20 * 10 ^ -3 * 10 ^9 = 2 * 10 ^ 7 bits
For 80 % utilisation = 0.8 * 2 * 10 ^ 7 = 1.6 * 10 ^ 7 bits.
The total no of packets = 1.6 * 10 ^ 7 / 1000 * 8 = 2000 packets.
WS = 2000
Correct Answer
https://gate.appliedroots.com/report?id=173769 12/39
5/15/2021 GATE CS Applied Course
Solution: (3)
If we compute the LCS’s of the above two strings can be computed using the DP table we will get
acacaca
cacaaca
cacacca
As the 3 possible longest common subsequences.
A 3
Solution: (B)
C 9
A S1 is True, S2 is True
B S1 is True, S2 is False
C S1 is False, S2 is True
https://gate.appliedroots.com/report?id=173769 13/39
5/15/2021 GATE CS Applied Course
Solution: (D)
C II only
Solution: (D)
A S/R conflict
B R/R conflict
https://gate.appliedroots.com/report?id=173769 14/39
5/15/2021 GATE CS Applied Course
Solution: (C)
A 180
B 220
Solution: (C)
We have 5 periods we can arrange 4 subjects in P(5,4) ways and one subject can be selected in C(4,1) ways as 2 subjects are identical we need to divide by 2! the
total no ways =P(5,4)*C(4,1)/2!=240.
Correct Answer
Solution: (70)
First transmission: 2 KB
Second transmission: 4 KB
Third transmission: 8 KB
Fourth transmission: 16 KB
Fi h transmission: 18 KB [ Th reached]
Sixth transmission: 20 KB [ timeout occurs new th = 10 KB]
Seventh transmission: 2 KB
Eighth transmission: 4 KB
Ninth transmission: 8 KB
Tenth transmission: 10 KB [ Th reached]
Eleventh transmission: 12 KB
https://gate.appliedroots.com/report?id=173769 15/39
5/15/2021 GATE CS Applied Course
Twel h transmission : 14 KB
Thirteenth transmission : 16 KB
Total time = 7 * 10 msec = 70 msec
B b, a, c
C c, a, b
Solution: (D)
Solution: (D)
W1(A), W1(B), W2(A), R2(B), C2, C1: It is not recoverable but it is serializable. The update operations of the schedules are serial, and therefore
serializable. However, since T2 commits before T1 we could end up in the following scenario: T2 commits completely but the system crashes
before T1 does. A er recovery, T2 would remain committed, but T1 would be rolled back because it has no log entry. Since the result of T2
depends on T1's completion, we would have a contradiction; T2 should not be able to complete if T1 does not complete.
https://gate.appliedroots.com/report?id=173769 16/39
5/15/2021 GATE CS Applied Course
W1(A), W1(B), W2(A), R2(B), C1, C2: It is both recoverable and serializable. The update operations of the schedules are serial, and therefore
serializable. For recoverability, the only read is R(B) in T2, and T2 does not commit until a er T1 has committed.
W2(A), W1(A), W1(B), R2(B), C1, C2: It is recoverable but not serializable. There is a cycle in the dependency graph T2--A->T1 and T1--B->T2, so
it's not serializable. However, T1 commits before T2, so it's recoverable.
A Correct Option
Solution: (A)
Solution: (B)
Solution: (12)
The MST of the above graph can be determined by Prim’s or Kruskal’s algorithm; the MST consists of the edges AB, BC, CD, DE, DF, the cost is given by
2+2+2+3+3=12.
https://gate.appliedroots.com/report?id=173769 17/39
5/15/2021 GATE CS Applied Course
Correct Answer
Solution: (1)
flag[i] set to true means that Pi is requesting access to the critical section.
The code satisfies mutual exclusion, but not progress.
Does not satisfy progress because: If the two processes set their flags to true at the same time, then they will both wait forever.
This also doesn't dis-satisfy the bounded waiting criteria. Because, bounded wait is not related to time. And yet, processes are not able to
continuously go in and dis-satisfy (violate) bounded waiting criteria.
https://gate.appliedroots.com/report?id=173769 18/39
5/15/2021 GATE CS Applied Course
Correct Answer
Solution: (24)
First iteration
i = 4, j=1
4 + (1 %7)==0 false || j> 5 false
else if
5 % 2 != 0 (true)
i=5
Second iteration
i=5,j=2
5 + (2 % 7) == 0 false || j > 5 false
Else if
7 mod 2 != 0 true
i bcomes = 6
Third iteration
i=6j=4
6 + ( 4 % 7) == 0 false || j>5 false
Else if
10 % 2 != 0 false.
K = i + j = 10
Fourth iteration
i=6,j=8
6 + 8 mod 7 == 0 false || j > 5 true
Break we come out from loop
So i = 6 , j = 8 , k = 10
I +j + k = 24
https://gate.appliedroots.com/report?id=173769 19/39
5/15/2021 GATE CS Applied Course
Solution: (9)
Solution: (D)
The meaning of the word “hospitality” is the quality or disposition of receiving and treating guests and strangers in a warm, friendly, generous way
which justifies that option (d) is the correct answer.
A 49,335
B 41,338
Solution: (C)
The required sum would be given by the sum of the series 110, 121, 132, ….., 990. The number of terms in the series = [(990-110)/11] + 1 = 80 + 1 = 81.
The sum of the series = 81 * 550 (average of 110 and 990) = 44,550.
D 47,300
https://gate.appliedroots.com/report?id=173769 20/39
5/15/2021 GATE CS Applied Course
Q.3)
Subject: General Aptitude Max Marks: 1
Solution: (C)
1, 5, 7 have two similar elements, one inside the other.
2, 4, 8 have one element placed inside a di erent element.
3, 6, 9 have two similar elements, one inside the other and the area between the two elements is shaded.
A Vitamins
Solution: (B)
Glucose is rich in carbohydrates and soyabean is rich in proteins.
C Minerals
D Legumes
B IOC’s employees work more than Private companies’ employees. Correct Option | Attempted
Solution: (B)
Options (a) and (d) do not follow as we do not know anything about who is better. From the two statements it is easy to conclude that IOC’s employees
work more than Private company employees. Hence option(b) is correct.
https://gate.appliedroots.com/report?id=173769 21/39
5/15/2021 GATE CS Applied Course
Solution: (A)
B Because …. instrumental
C Although …. formidable
D Because …. Immediate
A 2.689
Solution: (B)
C 2.2402
D 2.702
https://gate.appliedroots.com/report?id=173769 22/39
5/15/2021 GATE CS Applied Course
A 12, 4, 3
Solution: (B)
Integrated Circuits have a failure rate of 30 per thousand which translates into 3% [(30/1000)*100]. Thus, for an equipment using 400 of these, we need
to keep 3% spare. 3% of 400 = 12. Thus, we should keep a total of 12 Integrated Circuits as spare.
By the same logic, for capacitors we need 2% spares, for 240 we need a back-up of 4.8 capacitors, which gets rounded o to 5 capacitors.
Hence option(b) can be selected at this point as the correct answer.
C 5, 12, 4
D 12, 4, 4
A 2 Correct Option
https://gate.appliedroots.com/report?id=173769 23/39
5/15/2021 GATE CS Applied Course
Solution: (A)
B 6
C 8
D 4
A 1:2
B 25 : 121
C 5 : 18
Solution: (D)
https://gate.appliedroots.com/report?id=173769 24/39
5/15/2021 GATE CS Applied Course
Q.1)
Consider the following statements S1 and S2 : Subject: Discrete Mathematics Max Marks: 1
S1 : Every total order is also a partial order.
S2 : If |A| = 4 and |B| = 5, then there is not any surjective (onto) function from A to B.
Which of the following are incorrect?
Solution: (A)
S1 : TRUE. A total order is defined to be a partial order that also has the totality property.
S2 : TRUE. This is a standard result about surjections and size of finite sets.
Solution: (B)
S1 : TRUE. A total order is defined to be a partial order that also has the totality property.
S2 : TRUE. This is a standard result about surjections and size of finite sets.
Solution: (C)
S1 : TRUE. A total order is defined to be a partial order that also has the totality property.
S2 : TRUE. This is a standard result about surjections and size of finite sets.
Solution: (A)
All of the above options can be used as the return type in the function.
Solution: (B)
All of the above options can be used as the return type in the function.
C Pointers to variables, arrays, functions, struct variables, enum variables etc Correct Option | Attempted
Solution: (C)
All of the above options can be used as the return type in the function.
Solution: (D)
All of the above options can be used as the return type in the function.
Solution: (B)
ICMP (Internet Control Message Protocol) is used by the ping command to
determine if a given IP address is reachable on the network. This is done by
sending out an ICMP Echo Request message and, in response, receiving an
ICMP Echo Reply. While ICMP is used for other purposes, its use by the ping
https://gate.appliedroots.com/report?id=173769 25/39
5/15/2021 GATE CS Applied Course
Solution: (C)
ICMP (Internet Control Message Protocol) is used by the ping command to
determine if a given IP address is reachable on the network. This is done by
sending out an ICMP Echo Request message and, in response, receiving an
ICMP Echo Reply. While ICMP is used for other purposes, its use by the ping
command is probably the most well-known.
OSPF (Open Shortest Path First) is a distance-vector dynamic routing protocol
that uses the Dijkstra Shortest Path First (SPF) Algorithm to determine the best
path to a remote network.
RIP(Routing information protocol) used in the distance vector routing and it is a dynamic routing periodically changes the tables.
ARP (Address Resolution Protocol) allows a network host to request the MAC
address corresponding to a known IP address. Typically, a PC will send out an
ARP broadcast a er being powered on, so that the PC can learn the MAC
address corresponding to the IP address of the PC’s default gateway.
D ARP
Which of the following are not the average turnaround time for these processes with the SJF scheduling algorithm in units of time?
Solution: (A)
Solution: (B)
C 9.53
Solution: (D)
https://gate.appliedroots.com/report?id=173769 26/39
5/15/2021 GATE CS Applied Course
Solution: (A)
a.If we take AND between option a and both the available addresses we will get the same net id.
b. If we take AND between option b and both the available addresses we will get the same net id.
c. If we take AND between option c and both the available addresses we will get the same net id.
d. If we take AND between option d and both the available addresses we will get the same net id.
Solution: (B)
a.If we take AND between option a and both the available addresses we will get the same net id.
b. If we take AND between option b and both the available addresses we will get the same net id.
c. If we take AND between option c and both the available addresses we will get the same net id.
d. If we take AND between option d and both the available addresses we will get the same net id.
Solution: (C)
a.If we take AND between option a and both the available addresses we will get the same net id.
b. If we take AND between option b and both the available addresses we will get the same net id.
c. If we take AND between option c and both the available addresses we will get the same net id.
d. If we take AND between option d and both the available addresses we will get the same net id.
Solution: (D)
a.If we take AND between option a and both the available addresses we will get the same net id.
b. If we take AND between option b and both the available addresses we will get the same net id.
c. If we take AND between option c and both the available addresses we will get the same net id.
d. If we take AND between option d and both the available addresses we will get the same net id.
A Correct Option
https://gate.appliedroots.com/report?id=173769 27/39
5/15/2021 GATE CS Applied Course
Solution: (A)
C Correct Option
Solution: (C)
https://gate.appliedroots.com/report?id=173769 28/39
5/15/2021 GATE CS Applied Course
Solution: (D)
Solution: (B)
Here branching factor P is the order of the tree (number of children).
(i) It is not a legal B-Tree because the height is not balanced. More specifically, both the node with “BD” and “KS” are at the same level but “BD” is a
leaf and “KS” is not.
(ii) It is a legal B-Tree because the root node can have minimum 1 key value.
(iii) It is a legal B-Tree. There is no problem in the given B-Tree, the order is not less than 3 and it is balanced.
(iv) It is not legal B-Tree. There is no leaf node corresponding to the keys between G and L.
C Correct Option
Solution: (C)
Here branching factor P is the order of the tree (number of children).
(i) It is not a legal B-Tree because the height is not balanced. More specifically, both the node with “BD” and “KS” are at the same level but “BD” is a
leaf and “KS” is not.
(ii) It is a legal B-Tree because the root node can have minimum 1 key value.
(iii) It is a legal B-Tree. There is no problem in the given B-Tree, the order is not less than 3 and it is balanced.
(iv) It is not legal B-Tree. There is no leaf node corresponding to the keys between G and L.
https://gate.appliedroots.com/report?id=173769 29/39
5/15/2021 GATE CS Applied Course
Solution: (A)
S1 : FALSE. There could be as many as n(n-1)/2, which is greater than 2n - 1 for most n. For example, n could be 5, and we could have as many as
5(5-1)/2 = 10 edges, but 2n - 1 is only 9.
S2 : FALSE. If G is not connected, for example if it has more than one node and no edges at all, there is no such cycle.
Solution: (B)
S1 : FALSE. There could be as many as n(n-1)/2, which is greater than 2n - 1 for most n. For example, n could be 5, and we could have as many as
5(5-1)/2 = 10 edges, but 2n - 1 is only 9.
S2 : FALSE. If G is not connected, for example if it has more than one node and no edges at all, there is no such cycle.
Solution: (D)
S1 : FALSE. There could be as many as n(n-1)/2, which is greater than 2n - 1 for most n. For example, n could be 5, and we could have as many as
5(5-1)/2 = 10 edges, but 2n - 1 is only 9.
S2 : FALSE. If G is not connected, for example if it has more than one node and no edges at all, there is no such cycle.
https://gate.appliedroots.com/report?id=173769 30/39
5/15/2021 GATE CS Applied Course
Solution: (A)
https://gate.appliedroots.com/report?id=173769 31/39
5/15/2021 GATE CS Applied Course
Solution: (C)
https://gate.appliedroots.com/report?id=173769 32/39
5/15/2021 GATE CS Applied Course
D Correct Option
https://gate.appliedroots.com/report?id=173769 33/39
5/15/2021 GATE CS Applied Course
Solution: (D)
https://gate.appliedroots.com/report?id=173769 34/39
5/15/2021 GATE CS Applied Course
Solution: (A)
Solution: (C)
https://gate.appliedroots.com/report?id=173769 35/39
5/15/2021 GATE CS Applied Course
Solution: (A)
Solution: (C)
https://gate.appliedroots.com/report?id=173769 36/39
5/15/2021 GATE CS Applied Course
Solution: (D)
A The physical memory address value for the logical address of 16386 is 138446 Your answer is Wrong
B The logical address corresponding to the physical memory address of 90115 is 32771 Correct Option | Attempted
https://gate.appliedroots.com/report?id=173769 37/39
5/15/2021 GATE CS Applied Course
Solution: (B)
C The physical memory address value for the logical address of 16386 is 147458 Correct Option | Attempted
Solution: (C)
https://gate.appliedroots.com/report?id=173769 38/39
5/15/2021 GATE CS Applied Course
D The logical address corresponding to the physical memory address of 90115 is 36432 Your answer is Wrong
close
https://gate.appliedroots.com/report?id=173769 39/39