2019 Gate Cs Pyq Questions Solutions 141737642736402
2019 Gate Cs Pyq Questions Solutions 141737642736402
com
1
byjusexamprep.com
1. The expenditure on the project _________ as Since, both cars A and B are moving in same
follows: equipment Rs.20 lakhs, salaries Rs.12 direction, the relative speed = 60 – 50 = 10 km/hr
lakhs, and contingency Rs.3 lakhs. Distance required between them = 20 km
A. break down B. break dis tance 20
Time = = = 2hrs
C. breaks down D. breaks speed 10
Ans. C 4. Ten friends planned to share equally the cost of
Sol. buying a gift for their teacher. When two of them
Break down means to separate something into decided not to contribute, each of the other friends
smaller parts. The subject-word agreement states had to pay Rs 150 more. The cost of the gift was Rs.
that Singular nouns go with singular verbs while ___________.
plural nouns go with plural verbs. Expenditure is A. 666 B. 3000
singular noun, and its plural form is expenditures. C. 6000 D. 12000
The expenditure (singular noun) in the project Ans. C
breaks (singular verb used in the phrase) down Sol.
as follows. The above statement satisfies the Let share of each student = x
subject verb agreement and hence, the correct Total cost of gift = 10 * x
option is C. 10x = 8(x + 150)
2. The search engine’s business model ___________ 10x = 8x + 1200
around the fulcrum of trust. 2x = 1200
A. revolves B. plays x = 600
C. sinks D. bursts Thus, Total cost of gift = 10 × 600 = 6000.
Ans. A 5. A court is to a judge as ___________ is to a
Sol. teacher.
The search engine business model revolves around A. a student B. a punishment
the fulcrum of trust. C. a syllabus D. a school
Fulcrum is anything that plays a central or Ans. D
essential role in an activity, event, or situation. Sol.
3. Two cars start at the same time from the same A ‘court’ is for a ‘judge’ as a ‘school’ is for a
location and go in the same direction. The speed of ‘teacher’.
the first car is 50 km/h and the speed of the Court is a place where a judge works.
second car is 60 km/h. The number of hours it Similarly, school is a place where a teacher works.
takes for the distance between the two cars to be 6. The police arrested four criminals – P, Q, R and S.
20 km is ____________. The criminals knew each other. They made the
A. 1 B. 2 following statements:
C. 3 D. 6 P says, “Q committed the crime.”
Ans. B Q says, “S committed the crime.”
Sol. R says, “I did not do it.”
Speed of car A = 50 km/hr S says, “What Q said about me is false.”
Speed of car B = 60 km/hr
2
byjusexamprep.com
Assume only one of the arrested four committed 7. In the given diagram, teachers are represented in
the crime and only one of the statements made the triangle, researchers in the circle and
above is true. Who committed the crime? administrators in the rectangle. Out of the total
A. P B. R number of the people, the percentage of
C. S D. Q administrators shall be in the range of
Ans. B ___________.
Sol.
Case I:
committed crime and same time not committed 8. .“A recent High Court judgement has sought to
3
byjusexamprep.com
Ans. C
Sol. A.
4
byjusexamprep.com
D.
B.
Ans. D
Sol.
In such type of question use the Option
elimination method
C.
Because of Request from Z : We can select D as an
answer because none of the other option satisfy it.
So according to conditions mentioned in the
question ‘D’ is the best suited option.
5
byjusexamprep.com
TECHNICAL
There are no index bits in fully associative cache Sol. LR parser is a bottom-up parser. Hence, it uses
because every main memory block can go to any right most derivation in reverse order.
location in the cache ⟹ Index bits = 0. 4. In 16-bit 2’s complement representation, the
Given that memory is byte addressable and uses decimal number −28 is:
Cache Block size is 16 Bytes ⟹ Number of bits B. 0000 0000 1110 0100
required for Block Offset =⌈log216⌉=4 bits C. 1111 1111 1110 0100
Index = 0 bit (No address) Sol. +28 ⇒ 0000 0000 0001 1100
2. The chip select logic for a certain DRAM chip in a –28 ⇒ 1111 1111 1110 0100 (2’s complement
that the memory system has 16 address lines 5. Let U = {1,2,…,𝑛}. Let 𝐴={(𝑥, 𝑋)| 𝑥 ∈ 𝑋, 𝑋 ⊆ 𝑈}.
denoted by A15 to A0. What is the range of addresses Consider the following two statements on |𝐴|.
(in hexadecimal) of the memory system that can get I. |𝐴| = 𝑛2𝑛−1
6
byjusexamprep.com
The number of possible ordered pairs (x, X) where in 𝑛 bits. To avoid overflow, the representation of Z
x ∈ X is then 2n-1 sets. Now, for n elements total would require a minimum of:
n⋅ 2n-1 number of order pairs are possible. A. n bits B. n - 1 bits
Thus, statement I is true . C. n + 1 bits D. n + 2 bits
But since by the combinatoric identity Ans. C
n
n Sol. For example:
k k = n.2 n− 41
Let,
k =1
Statement II is identity similar to statement I, thus X = +6, n = 4
( X − Y ) = +11
also true. Y = −5, n = 4
6. Which one of the following is NOT a valid identity?
Hence,
A. (x ⨁ y) ⨁ z = x ⨁ (y ⨁ z)
Z = 11 which required 5 bits which is (n + 1) bits
B. (x + y) ⨁ z = x ⨁ (y + z)
9. Let X be a square matrix. Consider the following
C. x ⨁ y = x + y, if xy = 0
two statements on X.
D. x ⨁ y = (xy + x′y′)′
I. X is invertible.
Ans. B
II. Determinant of X is non-zero.
Sol.
Which one of the following is TRUE?
A. XOR is associative so(x⊕y)⊕z=x⊕(y⊕z)
A. I implies II; II does not imply I.
B. For 2 input, XOR and XNOR are complement to
B. II implies I; I does not imply II.
each other, i.e., x⊕y=(xy+x′y′)′
C. I does not imply II; II does not imply I.
C. x⊕y=x+y , if xy=0
D. I and II are equivalent statements.
Only false statement is option B.
Ans. D
7. If 𝐿 is a regular language over Σ = {𝑎,b}, which
Sol. Matrix is invertible if and only if it has nonzero
one of the following languages is NOT regular?
determinant.
A. 𝐿 ⋅ 𝐿𝑅 = {𝑥𝑦 | 𝑥 ∈ 𝐿, 𝑦𝑅 ∈ 𝐿}
And if the matrix has nonzero determinant, we can
B. {𝑤𝑤𝑅 | 𝑤 ∈ 𝐿}
find the inverse as well.
C. Prefix (𝐿) = {𝑥 ∈ 𝛴∗|∃𝑦 ∈ 𝛴∗ such that 𝑥𝑦 ∈ 𝐿} So, both I and II are equivalent statements.
D. Suffix (𝐿) = {𝑦 ∈ 𝛴∗|∃𝑥 ∈ 𝛴∗ such that 𝑥𝑦 ∈ 𝐿} 10. Let G be an arbitrary group. Consider the following
Ans. B relations on G:
Sol. R1: ∀𝑎, b ∈ 𝐺, 𝑎 𝑅1 𝑏 if and only if ∃𝑔 ∈ 𝐺 such that
If L is regular, L ⋅ LR is also regular by closure a = g-1 bg
property. R2: ∀𝑎, b ∈ 𝐺, 𝑎 𝑅2𝑏 if and only if a = b-1
Suffix (L) and Prefix (L) are also regular by closure Which of the above is/are equivalence
property. relation/relations?
However option (b) {wwR |w ∈ L} need not be A. R1 and R2 B. R1 only
regular since if L is an infinite regular language, then C. R2 only D. Neither R1 nor R2
{wwR |w ∈ L} will not only be infinite, but also non- Ans. B
regular. Since it involves string matching and we Sol. R1: ∀a, b ∈ G, a R1 b if and only if ∃g ∈ G such that
can increase in length indefinitely and then finite a = g–1bg
automata FA will run out of memory. Reflexive: a = g–1ag can be satisfied by putting g =
8. Consider Z = X – Y, where X, Y and Z are all in sign- e, identity “e” always exists in a group.
magnitude form. X and Y are each represented So, reflexive.
7
byjusexamprep.com
Symmetric: aRb ⇒ a = g–1bg for some g Sol. In a complete graph we can traverse the n vertices
⇒b= gag–1 = (g–1)–1 ag–1 in any order and return to the starting vertex and
form a Hamiltonian cycle. The number of such
g–1 always exists for every g ∈ G.
cycles will be n!
So, symmetric. However, since circular rotations will have to
Transitive: aRb and bRc ⇒ a = g1–1bg1 and b = g2– ignored. Since for example K4 with vertices {1, 2,
1 cg2 for some g1g2∈ G. 3, 4}, the cycle 1-2-3-4 is same as 2-3-4-1 is
Now a = g1 –1 g2 –1cg
2g1 = (g2g1 )–1cg 2g 1 same as 3-4-1-2 etc. we now get only (n – 1)!
g1∈ G and g2∈ G ⇒ g2g1∈ G since group is closed so distinct Hamiltonian cycles. Further, the cycle 1-2-
aRb and aRb ⇒ aRc hence transitive 3-4 and 1-4-3-2 are also same (clockwise and
Clearly R1 is equivalence relation. anticlockwise).
R2 is not equivalence it need not even be reflexive, So, ignoring this orientation also we finally get
since aR2 a ⇒ a = a–1∀a which not be true in a (n − 1) ! distinct Hamiltonian cycles.
group. 2
R1 is equivalence relation and thus B is the correct However, in gate answer key, the answer key was
answer. given as C or D.
11. Consider the following two statements about
x4 − 81
13. Compute lim
database transaction schedules: x →3 2x2 − 5x − 3
8
byjusexamprep.com
int i;
for (i=0; i<10; i++)
if (i%2 == 0) fork();
return 0;
L = {x |x = a2+3k or x = b10 + 12k, k ≥ 0}. Which one The total number of child processes created is
A. 3 B. 5 Sol.
L = {a2+3k or b10 + 12k} for k ≥ 0 So total processes created are =25-1= 31.
The pumping length is p, then for any string w ∈ L int jumble(int x, int y){
int main()
{
9
byjusexamprep.com
Compute the FOLLOW set of the non-terminal B and representations have the same most significant bit
write the index values for the symbols in the is ___________.
FOLLOW set in the descending order. (For example, Ans. 0.502 to 0.504
if the FOLLOW set is {a, b, d, $}, then the answer Sol.
should be 3210) The binary representation of numbers
Ans. 31 (1,2,3......13) in 4-bits:
Sol. 0 - 0000
S → Aa 1 - 0001
A → BD 2 - 0010
B→b|∈ 3 - 0011
D→d|∈ 4 - 0100
Follow (B) = {d, a} 5 - 0101
Hence their index in descending order is 31. 6 - 0110
20. An array of 25 distinct elements is to be sorted using 7 - 0111
quicksort. Assume that the pivot element is chosen 8 - 1000
uniformly at random. The probability that the pivot 9 - 1001
element gets placed in the worst possible location in 10 - 1010
the first round of partitioning (rounded off to 2 11 - 1011
decimal places) is ________. 12 - 1100
Ans. 0.08 13 - 1101
Sol. As it can be seen that there are 6 numbers whose
Given an array of 25 distinct elements, and pivot MSB is 1, and 7 numbers which start with 0.
element is chosen uniformly randomly. So, there are So the probability that their 4-bit binary
only 2 worst case position in the pivot element, that representation have the same MSB is :
is, it is either first (or) last. = P(MSB is 0) + P(MSB is 1)
Therefore, required probability is, = (7*7)/(13*13) + (6*6)/(13*13)
= 2/25 = (49+36)/169
= 0.08 = 85/169
21. The value of 351 mod 5 is ________. =0.5029
Ans. 2 23. Consider three concurrent processes P1, P2 and P3
Sol. as shown below, which access a shared variable D
By Fermat’s theorem that has been initialized to 100
3(5 – 1) mod 5 = 1 P1 P2 P3
34 mod 5 = 1 : : :
Now, 351 mod 5 = (34)12 . 33 mod 5 : : :
= 33 mod 5 D=D+ D = D – 50 D = D + 10
=2 20
22. Two numbers are chosen independently and : : :
uniformly at random from the set : : :
{1, 2,...,13}. The probability (rounded off to 3 The processes are executed on a uniprocessor
decimal places) that their 4-bit (unsigned) binary system running a time-shared operating system. If
10
byjusexamprep.com
the minimum and maximum possible values of D The maximum sum of the array
after the three processes have completed {6, 3, -1, -2, 13, 4, -9, -1, 4, 12 }
execution are X and Y respectively, then the value which sum up to 29.
of Y – X is _____________. 26. Consider the following C function.
Ans. 80 void convert(int n){
Sol. if(n<0)
Total possible sequences of execution are: P1 P2 printf(“%d”,n);
P3, P1 P3 P2, P2 P1 P3, P2 P3 P1, P3 P1 P2 and P3 else {
P2 P1. convert(n/2);
Whatever the sequence we will use to execute, we printf(“%d”,n%2);
will get 80 as answer. }
So, X= 50 and Y= 130 }
Hence, Y-X = 80 Which one of the following will happen when the
24. Consider the following C program: function convert is called with any positive integer
#include <stdio.h> n as argument?
int main(){ A. It will print the binary representation of n and
int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, terminate
*ip=arr+4; B. It will print the binary representation of n in the
printf(“%d\n”, ip[1]); reverse order and terminate
return 0; C. It will print the binary representation of n but
} will not terminate
The number that will be displayed on execution of D. It will not print anything and will not terminate
the program is ___________ . Ans. D
Ans. 6 Sol.
Sol. Let n=5,
Here answer will be 6. function calling goes as: convert(5) → convert(2)
ip is an integer pointer. The initial assignment sets → convert(1) → convert(0) now when we go for
it to the element at array index 4 i.e. 5. convert(0) then in if condition its mentioned as
Hence ip holds address of array index 4 if(n<0) but our n = 0 , so still the condition is
The next statement refers to the next integer after false, it will go into else block and implement
it which is 6(ip[1]=∗(ip+1)) convert(0/2) which is convert(0) , so it will go on
calling the same way again and again leading to
25. Consider a sequence of 14 elements: A = [−5, −10, stack overflow.
6, 3, −1, −2, 13, 4, −9, −1, 4, 12, −3, 0]. The Hence, the program will not print anything (as
subsequence sum 𝑆(𝑖, 𝑗) = ∑𝑗𝑘=𝑖 𝐴[𝑘] . Determine the after every function call, the value returned is
maximum of S(i, j), where 0 ≤ i ≤ j < 14. (Divide greater than 0) and will not terminate.
and conquer approach may be used.) 27. Consider the following C program:
Ans. 29 #include<stdio.h>
11
byjusexamprep.com
12
byjusexamprep.com
13
byjusexamprep.com
S2 Set of all syntactically valid C programs Clearly ϕ is true in S2 and S3 since in set of all
S3 Set of all languages over the alphabet {0,1} integers as well as all positive integers, there is a
S4 Set of all non-regular languages over the prime number greater than any given prime
alphabet {0,1} number.
Which of the above sets are uncountable? However, in S1 : {1, 2, 3, .....100} ϕ is false since
A. S1 and S2 B. S3 and S4 for prime number 97 ∈ S1 there exists no prime
C. S2 and S3 D. S1 and S4 number in the set which is greater.
Ans. B So correct answer is C.
Sol.
S1: The set LRE is known to be countably infinite 36. Consider the following grammar and the semantic
since it corresponds with set of turing machines. actions to support the inherited type declaration
S2: Since syntactically valid C programs surely run- attributes. Let X1, X2, X3, X4, X5, and X6 be the
on Turing machines, this set is also a subset of set placeholders for the non-terminals D, T, L or L1 in
of Turing machines, which is countable. the following table:
S3: Set of all languages = 2Σ which is known to be Production
Semantic action
uncountable. Σ* countably infinite rule
⇒ 2Σ is uncountable. D → TL X1.type = X2.type
S4: Set of all non-regular languages includes set LNOT
T → int T.type = int
RE which is uncountable infinite and hence is
uncountable. T → float T.type = float
14
byjusexamprep.com
37. There are n unsorted arrays: A1, A2, …, An. Assume [Note: The converse of II is not true, but that is
that n is odd. Each of A1, A2, …, An contains n distinct not relevant to this question]
elements. There are no common elements between So, both I and II are true.
any two arrays. The worst-case time complexity of 39. Consider the following snapshot of a system
computing the median of the medians of A1, A2, …, running 𝑛 concurrent processes. Process 𝑖 is
An is holding 𝑋𝑖 instances of a resource R, 1 ≤ 𝑖 ≤ 𝑛.
A. O(n) B. O(n log n) Assume that all instances of R are currently in use.
C. O(n2) D. Ω(n2 log n) Further, for all 𝑖, process 𝑖 can place a request for
Ans. C at most 𝑌𝑖 additional instances of R while holding
Sol. Given that all lists are unsorted, therefore we can't the 𝑋𝑖 instances it already has. Of the 𝑛 processes,
apply Binary search. there are exactly two processes 𝑝 and 𝑞 such
one way to find median is sorting the list, it takes that 𝑌𝑝 = 𝑌𝑞 = 0. Which one of the following
Θ(nlogn), But without sorting we can find median conditions guarantees that no other process apart
in O(n). from 𝑝 and 𝑞 can complete execution?
For one list it takes O(n), then for n-lists it takes A. 𝑋𝑝 + 𝑋𝑞 < Min {𝑌𝑘 | 1 ≤ 𝑘 ≤ n ,k ≠ p, k ≠ q}
O(n2). B. 𝑋𝑝 + 𝑋𝑞 < Max {𝑌𝑘 | 1 ≤ 𝑘 ≤ n,k ≠ p, k ≠ q}
So, now median of every list in our hand! C. Min (𝑋p, X𝑞) ≥ Min {𝑌𝑘 | 1 ≤ 𝑘 ≤ 𝑛, k ≠ p, k ≠ q}
note that these medians are also not sorted! D. Min (𝑋𝑝, X𝑞) ≤ Max {𝑌𝑘 | 1 ≤ 𝑘 ≤ 𝑛, k ≠ p, k ≠
Therefore, make all these medians as one list, then q}
with in O(n) time we can find the median of Ans. A
medians. Sol. The process P holds Xp resources currently and it
T.C=O(n2)+O(n)=O(n2). doesn't request any new resources. Therefore, after
38. Let G be any connected, weighted, undirected some time, it will complete its execution and release
graph. the resources which it holds.
I. G has a unique minimum spanning tree, if no The process Q holds Xq resources currently and it
two edges of G have the same weight. doesn't request any new resources. Therefore, after
II. G has a unique minimum spanning tree, if, for some time, it will complete its execution and release
every cut of G, there is a unique minimum-weight the resources which it holds.
edge crossing the cut. Total available resources after completion of P and
Which of the above two statements is/are TRUE? Q=Xp+Xq.
A. I only B. II only If these resources cannot satisfy any process new
C. Both I and II D. Neither I nor II requests, then no process will be able to completes
Ans. C its execution.
Sol. Xp+Xq< Min{Yk∣1≤k≤n,k≠p,k≠q}⟹ delivers that
If no two edges of G have same weight surely G no process going to completes except P and Q.
will have unique spanning tree is true. Answer is (A)
So I is true 40. Consider the following statements:
Also if, for every cut of G, there is a unique I. The smallest element in a max-heap is always at
minimum weight edge crossing the cut then G will a leaf node.
have unique spanning tree is also true. So II is II. The second largest element in a max-heap is
true always a child of the root node
15
byjusexamprep.com
These processes are run on a single processor using 43. Consider the augmented grammar given below:
preemptive Shortest Remaining Time First S' → S
scheduling algorithm. If the average waiting time of S → 〈L〉 | id
the processes is 1 millisecond, then the value of Z L → L, S | S
is________. Let I0 = CLOSURE ({[S' → •S]}). The number of
Ans. 2 items in the set GOTO (I0, 〈) is: ________.
Sol. Till time = 4 units, this is the Gantt chart: Ans. 5
Sol.
16
byjusexamprep.com
Total number of items in the set GOTO So, memory bandwidth =32/12 cycle time=32/ 12/
(I0, 〈) is 5. (60×106) = 160×106 bytes/s
44. Consider the following matrix: 46. Let T be a full binary tree with 8 leaves. (A full binary
The absolute value of the product of Eigen values the unique path between a and b) is (rounded off to
Sol. Sol.
Product of eigenvalues is same as the determinant See the word "independently" here. It means that
of a matrix. choice of ‘a’ must not affect choice of ‘b’ and vice
1 versa. This implies that both ‘a’ and ‘b’ can even be
2 22 23 1 2 22 23
the same node.
1 3 32 33 1 3 − 2 32 − 22 33 − 23
=
1 4 42 43 1 4 − 2 42 − 22 43 − 23 Now, we are given that the binary tree has 8leaves.
1 5 52 53 1 5 − 2 52 − 22 53 − 23 (23=8) ⟹we have 3 levels in the tree starting from
0. The distance I n terms of number of
1 5 19
edges between any two leaf nodes will always
= (3 − 2) ( 4 − 2 ) (5 − 2 ) 1 6 28
1 7 39 be even. If we consider any two leaves (not
necessarily distinct)
1 5 19
• No. of pairs with path length0= 8. (When a=b)
= 1.2.3 0 1 9
• No. of pairs with path length2=8. (For each of the 8
0 2 20
leaf nodes, we have a pair and since the selection
= 1.2.3.2 = 12 is independent order of the pair is also significant)
45. A certain processor deploys a single-level cache. The • No. of pairs with path length4=16. (For each leaf
cache block size is 8 words, and the word size is 4 node we must go two levels up and while coming
bytes. The memory system uses a 60-MHz clock. To down we have 2 choices. So, we get 8×2=16
service a cache miss, the memory controller first pairs)
takes 1 cycle to accept the starting address of the • No. of pairs with path length6=32. (For each leaf
block, it then takes 3 cycles to fetch all the eight node we must go till the root, and from there while
words of the block, and finally transmits the words coming down it has 2×2=4 choices. Thus, we
of the requested block at the rate of 1 word per get8×4= 32 pairs.
cycle. The maximum bandwidth for the memory • Total number of possible pairs=8×8=64
system when the program running on the processor No. of pairs with path length 0=8.
issues a series of read operations is __________× No. of pairs with path length 1=0.
106 bytes/sec. No. of pairs with path length 2=8.
Ans. 160 No. of pairs with path length 3=0.
Sol. No. of pairs with path length 4=16.
Time to transfer a cache block =1+3+8=12 cycles. No. of pairs with path length 5=0.
i.e., 4 bytes ×8=32 bytes in 12 cycles. No. of pairs with path length 6=32.
17
byjusexamprep.com
Total number of possible pairs =8×8=64 is closed every arrow has to go to some
So, expected path length, E(x), permutation and hence some state.
=0×(8/64)+2×(8/64)+4×(16/64)+6×(32/64)=27 Since the language only has those strings where
2/64=4.25 π(x) = id only the starting state (“id” state) will be
the final state.
47. Suppose Y is distributed uniformly in the open Sample machine with only 2 states is shown
interval (1, 6). The probability that the polynomial below:
3x2 + 6xY + 3Y + 6 has only real roots is (rounded
off to 1 decimal place) ________.
Ans. 0.8
Sol.
It is given that, Polynomial 3x2 + 6xY + 3Y + 6 has
49. Consider that 15 machines need to be connected in
only real roots
a LAN using 8-port Ethernet switches. Assume that
b2 – 4ax ≥ 0
these switches do not have any separate uplink
(6Y)2 – 4(3) (3Y+ 6) ≥ 0
ports. The minimum number of switches needed
Y2 – Y - 2 ≥ 0
is__________.
Y ∈ (–∞, – 1] ∩ [2, ∞)
Ans. 3
⇒ Y ∈ [2, 6)
Sol. If a switch has 8 ports, then it means it can
Since Y is uniformly distributed in (1, 6)
connect maximum 8 host and 2 switch can connect
So, we need to consider the range (2,6).
16 hosts independently. But we need one port for
The probability = (1/ (6-1)) * (6-2) = 1/5 * 4 =
both, to connect with each other. So, now one- one
0.8
port is used from both the switches for connecting
then total port available or free on both the switch
48. Let Σ be the set of all bijections from {1,….,5} to
is 7. So maximum 14 host can be connected but
{1,…,5}, where 𝑖𝑑 denotes the identity function,
for the 15th host we need another switch.
i.e. id(𝑗) = 𝑗, ∀𝑗. Let ∘ denote composition on
3 switches of ethernet are required to connect 15
functions. For a string 𝑥 = 𝑥1 𝑥2 ⋯ 𝑥𝑛 ∈ Σ𝑛, 𝑛 ≥ 0, let
computers.
π (𝑥) = 𝑥1 ∘ 𝑥2 ∘ ⋯ ∘ 𝑥𝑛.
Hence, 3 is correct answer.
Consider the language 𝐿 = {𝑥 ∈ Σ∗| (𝑥) = 𝑖𝑑}. The
50. What is the minimum number of 2-input NOR gates
minimum number of states in any DFA accepting L
required to implement a 4-variable function
is _________.
expressed in sum-of-minterms form as f = Σ (0, 2,
Ans. 120
5, 7, 8, 10, 13, 15)? Assume that all the inputs and
Sol.
their complements are available.
The DFA for accepting L will have 5! = 120 states,
Ans. 3
since we need one state for every possible
Sol.
permutation function on 5 elements. The starting
f = Σm (0, 2, 5, 7, 8, 10, 13, 15)
12345 f = ΠM(1, 3, 4, 6, 9, 11, 12, 14)
state will be “id” state, named as and
12345
from there n! arrows will go the n! states each
named with a distinct permutation of the set {1, 2,
3, 4, 5}. Since composition of permutation function
18
byjusexamprep.com
51. A relational database contains two tables Student 52. Consider the following C program:
19
byjusexamprep.com
true j=4+4=8---> print sum Function, then the prime factor of 𝑛 which is greater
2 than 50 is ____________________.
4th iteration- i/j= = 0.25 0.0625
8 Ans. 97
true j=8+8=16--->print sum Sol.
2 n = p × q = 3007
5th iteration- i/j= = 0.125 0.0625
16 By RSA algorithm, n = 31 × 97 in which 97 is
true j=16+16=32---> print sum prime factor which greater than 50.
2
6th iteration- i/j= = 0.0625 0.0625 false --
32 55. Consider the following relations P(X,Y,Z), Q(X,Y,T)
-loop terminates and R(Y,V).
Hence Sum is printed 5 times.
53. Consider the following C program:
#include <stdio.h>
int main()
{
int a[] = {2, 4, 6, 8, 10}; How many tuples will be returned by the following
sum=sum+(∗b−i)−∗(b−i) X
i=0 X2
sum=0+(10−0)−(10)=0
i=1 σ(Q.Y=R.Y ∧ Q.T>2)(Q × R)
sum=0+(10−1)−(8)=1 X Y T V
i=2
X1 Y1 6 V1
sum=1+(10−2)−(6)=3
X1 Y2 5 V3
i=3
X1 Y2 5 V2
sum=3+(10−3)−(4)=6
∏x(σ(Q.Y=R.Y ∧ Q.T>2)(Q × R))
i=4
Y
sum=6+(10−4)−(2)=10
54. In an RSA cryptosystem, the value of the public X1
modulus parameter 𝑛 is 3007. If it is also known ∏x(σ(P.Y=R.Y ∧ R.V=V2)(P × R)) - ∏x(σ(Q.Y=R.Y ∧ Q.T>2)(Q ×
that φ(𝑛) = 2880, where φ() denotes Euler’s Totient R))
20
byjusexamprep.com
****
21