Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

PRE‐GATE‐2019

Computer Science and Information Technology


(Questions with Detailed Solutions)

The GA section consists of 10 questions. Questions 1 to 5 are of 1 mark each, and


Questions 6 to 10 are of 2 marks each.
Q. 1 – Q. 5 carry one mark each.

01. Find the missing number from the given alternatives

45 20 40

25 27 35 60 30 40 25 ? 35

30 30 65

(A) 36 (B) 33
(C) 45 (D) 60
01. Ans: (B)
135
Sol: As, 25 + 45 + 35 + 30 = 135 =  27
5
150
And 60 + 20 + 40 + 30 = 150 =  30
5
Similarly 25 + 40 + 35 + 65 = 165
165
  33
5
Hence, option (B) is correct

02. Identify the correct sentence as per the standard English


(A) I taught the dog to lay down and roll over.
(B) I taught the dog to lie down and roll over.
(C) I taught the dog to laid down and roll over.
(D) I taught the dog to lied down and roll over.
02. Ans: (B)

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 2 : CSIT

03. Which of the following options is closest in meaning to the underlined word?
There was a homogeneity of outlook.
(A) diversity (B) unspoiled freshness
(C) similarity (D) stubbornness
03. Ans: (C)

04. Fill in the blank with an appropriate phrase


The gardens were _______ with lawns and flower beds.
(A) laid about (B) laid out
(C) laid off (D) laid by
04. Ans: (B)

05. The question below consists of a pair of related words followed by four pairs of words. Select
the pair that best expresses the relation in the original pair.

SOLDIER : ARMY
(A) gas : Vapour
(B) music : harmony
(C) ruler : height
(D) element : compound
05. Ans: (D)
Exp: Group of soldiers form an army, just as group of elements form a compound.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 3 : PRE‐GATE_2019

Q. 6 – Q. 10 carry Two marks each.

06. Nine men and seven women can complete a piece of work in five days. The same work can be
completed by seven men and eleven women in four days, which of the following statements is true
regarding the efficiency of the men and women?
8
(A) Men are more efficient than women by 88 %
9
8
(B) Women are more efficient than men by 88 %
9
8
(C) Men are more efficient than women by 18 %
9
8
(D) Women are more efficient than men by 18 %
9
06. Ans: (B)
1
Sol: 9 men and 7 women complete th of the work in 1 day
5
 45 men and 35 women can complete the work in 1 day
1
7 men and 11 women can complete th of the same work in 1 day
4
 28 men and 44 women can complete the work in 1 day
 45 men + 35 women
 28 men + 44 women
 17 men = 9 women
women 17 8
  1
men 9 9
8 8
 Women are more efficient by  100 = 88 %
9 9
Hence, option (B) is correct

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 4 : CSIT

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 5 : PRE‐GATE_2019

07. What is the approximate volume of the piece shown in the given figure which has a rectangular
prism surrounded by a triangular prism (of cross-section equilateral triangle)? The height of the
entire piece is 13 cm and that of the rectangular piece is 10 cm

10 cm
2 cm

(A) 252 cm3 (B) 400 cm3


(C) 216 cm3 (D) 236 cm3
07. Ans: (A)
Sol: The total height of the piece is 13 cm and the height of the rectangular piece is 10 cm, the height of
the triangular piece = 13 – 10 = 3 cm. Since the triangular piece is an equilateral triangle, from its
height 3 cm, we get the side of the triangle as 2 3 cm.

3
 side   length
2
Volume of the top portion = Area × length =
4

=
4
3
 
2
 2 3  10  30 3  52cm 3

Volume of the bottom portion = 10 × 10 × 2 = 200 cm3


 Total volume = 252 cm3
Hence, option (A) is correct

08. In a primary school, the average weight of male students is 65.9 kg and the average weight of
female students is 57 kg. If the average weight of all the students (both male and female) is 60.3 kg
and the number of male students in the school is 66, then what is the number of female students in
the school?
(A) 152 (B) 162 (C) 168 (D) 112
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 6 : CSIT

08. Ans: (D)


Sol: Average weight of male students = 65.9 kg
Average weight of female students = 57.0 kg
Average weight of total students = 60.3 kg
Let the total number of students be ‘x’
65.9  66  x  66  57
Then,  60.3
x
65.9 × 66 + 57x – 57 × 66 = 60.3x
(65.9 – 57) × 66 = 3.3 x
8.9 × 66 = 3.3 x  x = 178
 Number of female students = 178 – 66 = 112
Hence, option (D) is correct

09. Study the following pie charts and answer the given question
Distribution of total number of Dell laptops sold by 5 stores

T P
21% 15%
S Q
9% 25%
R
30%

Total number = 2400

Distribution of number of Laptops (both Dell and Lenovo) sold by 5 stores in 2011

T P
15% 16%
S Q
11% 23%
R
35%

Total number = 4500


ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 7 : PRE‐GATE_2019

What is the difference between number of Laptops (both dell and Lenovo) sold by store Q and
total number of Lenovo Laptops sold by store ‘R’ and ‘S’ together?
(A) 185 (B) 99 (C) 91 (D) 119
09. Ans: (B)
23
Sol: Number of laptops (Dell and Lenovo) sold by store Q = 4500   45  23  1035
100
46
Now, total number of Laptops (Lenovo and Dell) sold by R and S together = 4500   2070
100
39
Number of Dell laptops sold by ‘R’ and ‘S’ together = 2400   936
100
Number of Lenovo laptops = 2070 – 936 = 1134
 Required difference = 1134 – 1035 = 99

10. Stronger patent laws are needed to protect inventions from being pirated. With that protection
manufacturers would be encouraged to invest in the development of new products and
technologies. Such investment frequently results in an increase in manufacturer’s productivity.
Which of the following conclusions can most properly be drawn from the information above?
(A) Stronger patent laws tend to benefit financial institutions as well as manufacturers.
(B) Increased productivity in manufacturing is likely to be accompanied by the creation of more
manufacturing jobs.
(C) Manufacturers will decreases investment in the development of new products and technologies
unless there are stronger patent laws.
(D) Stronger patent laws would stimulate improvements in productivity for many manufacturers.
10. Ans: (D)
Sol: Stronger patent laws increase protection; protection encourages investment; investment often
raises productivity. Thus, stronger patent laws initiate a chain of events that often culminates in
improved productivity. Choice D expresses that and is, therefore, the best answer.
Choice A is inappropriate because the role, if any, that financial institutions would play in
investments is left open. The increased productivity mentioned in B may mean fewer hours of
labour for a given level of output, and may, thus, threaten jobs. Investments of the sort described in
C may already be at the lowest possible level.
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 8 : CSIT

Q. 11 – Q. 35 carry one mark each.

11. Consider the following finite automata

b a

a
A B

The number of equivalence classes for the language accepted by above finite automata is ____.
11. Ans: 1
Sol: Given DFA has 2 states
After minimization, modified equivalent DFA will have only one state

a, b
AB

The language is (a+b)*. It has only one equivalence class.

 2  3
12. Let A    . If one of the eigen values of A is 3, then a = _____.
a 5 
12. Ans: 0.6666 Range 0.6 to 0.7
Sol: Let  be the second eigen value of A.
We know that, sum of the eigen values of A = Trace of A
3+=2+5
=4
Again, product of the eigen values of A = |A|
 12 = 10 + 3a
2
a= = 0.666
3

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 9 : PRE‐GATE_2019

13. Consider directed broadcast address of the sub-network is 200.200.200.191 then the maximum
possible number of hosts in this sub-network is __________.
13. Ans: 62
Sol: 200.200.200.10111111
6 bit host ID (at max)
# hosts (in this subnetwork) = (26 – 2) = 62 hosts

14. If f(x) = x2 and g(x) = x3 then, the mean value C satisfying Cauchy's Mean Value theorem in the
interval (1, 2) is ______.
14. Ans: 1.555 Range: 1.5 to 1.6
Sol: Here, f(x) and g(x) satisfy the conditions of Cauchy's mean value theorem.
By Cauchy's mean value theorem, there exists a value C  (1, 2) such that
f (C ) f 2  f 1
 ............ (1)
g (C ) g 2  g 1
2C 4  1
 
3C 2 8  1
14
 C= = 1.555
9

15. Minimum number of “T” flip-flops required to design MOD-253 counter is_________.
15. Ans: 8
Sol: Formula: N  2n
Here N = Total number of different states [MOD]
n = number of flip-flops required
Given N = 253
N  2n

n  27  128 
253  2  
 2  256
8

To satisfy above “n” value should be 8


253  28 hence n = 8

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 10 : CSIT

16. A relation R(ABC) with functional dependencies AB  C, A  B and B  A.


The number of irreducible sets of the functional dependencies is _______.
16. Ans: 2
Sol: • From AB  C; the attribute 'B' can be deleted as A  B results an irreducible set
{A  C, A  B, B  A}
 From AB  C; the attribute 'A' can be deleted as B  A results an irreducible set
{B  C, A  B, B  A}

17. int f(int n)


{
static int r = 0;
if (n < =0)
return 0;
if (n% 2 = = 0)
{
r = n;
n
return f   + r;
2
}
return f (n–1) +r;
}
What is the return value of f(6)?
(A) 8 (B) 12
(C) 9 (D) 13

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 11 : PRE‐GATE_2019

17. Ans: (A)


Sol:

r f(6)
n
062 8 6

f(3) + r
n
6 3

f(2) + r
n
4 2

f(1) + r
n
2 1

f(0) + r
n
0 0

Distractor Logic
DLOA: Refer to solution
DLOB: If student is evaluated f(3) + r as f(3)+6 then 12 is output
DLOC: If student takes return value of function at n = 0 is ‘1’ then 9 is output
DLOD: If student is evaluated f(3)+r as f(3)+6 and find return value at n = 0 is 1 then output is 13

18. Find correct statement regarding routing protocols RIP and BGP?
(A) RIP and BGP both uses TCP as transport protocol
(B) RIP and BGP both uses UDP as transport protocol
(C) RIP uses UDP and BGP uses TCP as transport protocol
(D) RIP uses TCP and BGP uses UDP as transport protocol

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 12 : CSIT

18. Ans: (C)


Sol: RIP  UDP and BGP  TCP

19. Find the equivalent Regular Expression for the following regular expression.
(a+b)* ab (a+b)*

(A) a* b* (a+b)* (B) a+ b* (a+b)*


(C) b* a+ b (a+b)* (D) b* a* b (a+b)*
19. Ans: (C)
Sol: Given, (a+b)* ab (a+b)*
It generates all strings where each string contains ‘ab’ as substring.

Distractor Logic:
DLOA: a*b* (a+b)* generates ‘’, so it is invalid expression.
DLOB: a+ b* (a+b)* generates ‘a’, so it is also invalid expression.
DLOC: b*a+ b (a+b)* generates all strings where each string contains ‘ab’ as substring.
DLOD: b*a*b (a+b)* generates ‘b’, so it is invalid expression.

20. Consider data is 10110101 and generator polynomial G(x) is x3 + 1 then calculate CRC.
(A) 000 (B) 001
(C) 010 (D) 011
20. Ans: (B)
Sol:
1 0 0 1) 1 0 1 1 0 1 0 1 0 0 0
1011 ⁞ ⁞
1001 ⁞
1001 ⁞
1000
1001
0 0 1→ CRC

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 13 : PRE‐GATE_2019

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 14 : CSIT

21. Let N be set of all positive integers. A function f : N  N is defined by f(x) = x2 + 2.


Which of the following is true?
(A) f is injective but not surjective (B) f is surjective but not injective
(C) f is a bijection (D) f is neither injective nor surjective
21. Ans: (A)
Sol: Let f(a) = f(b)
 a2 + 2 = b2 + 2
 a2 = b2
a=b ( a and b are positive integers)
 f is injective
f is not surjective.
For example, if y = 1 then there is no positive integer x such that,
f(x) = x2 + 2 = y
 Option (A) is true.

Distractor Logic:
DLOA: Refer to solution
DLOB: Since, f is not surjective, option (B) is false
DLOC: Since, f is not surjective, option (C) is false
DLOD: Since, f is injective, option (D) is false

22. In which of the following file allocation techniques, a file content can only be accessed
sequentially but not randomly.
(A) Indexed Allocation
(B) Linked Allocation
(C) Contiguous Allocation
(D) Allocation using File Allocation Table (FAT)

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 15 : PRE‐GATE_2019

22. Ans: (B)


Sol: In Linked allocation, the file system only stores the address of the first block allocated to the file.
The address of second block of the file is stored in the first block, and so on, thereby creating a
linked list of blocks. So, to access any block in the chain, we have to first access the first block and
find the addresses of the next block, and so on. We cannot know all the addresses of all blocks
without accessing the actual blocks of the linked list. So the file has to be accessed only in
sequential manner and random access to any block of file is not possible.
In rest of the techniques, both sequential and random access to the file content is possible.
Sequential access is possible for any allocation method.

Distractor Logic:
DLOA: Indexed allocation, a table of addresses of block allocated to a file is created. So we
can access file content randomly.
DLOB: Refer to solution
DLOC: Contiguous allocation does not mean the access is sequential. Since we can
calculate the block address using the first block’s address, random access to file is
possible.
DLOD: Since, FAT stores the block numbers allocated to all files in disk, we can get
address of any block allocated to a file and then access it. So random access is
possible.

23. The maximum number of keys that can be inserted into the following B-Tree of order 3, without
changing the level is

20

10 30

5 15 25 35

(A) 7 (B) 10
(C) 19 (D) None of these
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 16 : CSIT

23. Ans: (C)


Sol: The maximum number of keys that can be stored in a B-Tree of order 3 of 2 levels is 32+1–1= 26.
Tree already has 7 keys; the remaining keys possible are 26 – 7 = 19.

Distractor Logic:
DLOA: Student may think there are 7 empty places in the tree, which will be wrong
because it should be height balanced.
DLOB: Student may think that there is one more similar sub tree for a root may possible,
then there could be 10 empty places in the tree, which will be wrong because it
should be height balanced.
DLOC: Refer the solution
DLOD: Because option (C) is correct, none is incorrect.

24. The dual of (p  q) is


(A) (p  q)  (~p  ~q) (B) (p  q)  (~p  ~q)
(C) (p  q)  (~p  ~q) (D) (p  q)  (~p  ~q)
24. Ans: (B)
Sol: Consider, p  q
 (p  q)  (q  p)
 (~p  q)  (~q  p)
The dual of the above formula is
(~p  q)  (~q  p) ............ (1)
 (~p  ~q)  (p  q) .............(2)
 Option (B) is correct.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 17 : PRE‐GATE_2019

Distractor Logic
DLOA: The formula given in option (A) is not equivalent to either (1) or (2).
Therefore, option (A) is not correct.
DLOB: Refer the solution
DLOC: The formula given in option (C) is a tautology. Where as, the formulas in (1) and
(2) are contingencies.
Therefore, option (C) is not correct.
DLOD: The formula given in option (D) is a tautology. Where as, the formulas in (1) and
(2) are contingencies.
Therefore, option (D) is not correct.

25. Let G is a simple connected graph with 10 vertices and no cycles of odd length. The number of
edges in G should lie between ________ and _______.
(A) 10 and 45 (B) 9 and 20
(C) 10 and 25 (D) 9 and 25
25. Ans: (D)
Sol: If G has no cycles of odd length, then G is a bipartite graph.
The simple connected bipartite graph with minimum number of edges is a tree.
 The minimum number of edges necessary in G = 9
 n2 
Maximum edges possible in a bipartite graph with n vertices =  
4
where n = 10
100 
 Maximum number of edges possible in G =  = 25
 4 
Hence, number of edges in G should lie between 9 and 25.
 Option (D) is correct.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 18 : CSIT

Distractor Logic:
DLOA: Option (A) is false, because number of edges in a bipartite graph with 10 vertices
can be 9.
DLOB: Option (B) is false, because number of edges in a bipartite graph with 10 vertices
can exceed 20.
DLOC: Option (C) is false, because number of edges in a bipartite graph with 10 vertices
can be 9.
DLOD: Refer to solution

26. Consider the following context free grammar G.


S→ aSa | bSb | aa | bb | 
The language generated by G is________
(A) Regular language (B) Inherently unambiguous language
(C) Deterministic context free language (D) Finite language
26. Ans: (B)
Sol S→ aSa | bSb | aa | bb | 
L(G) = {wwR | w (a+b)*}
= Set of all even length palindromes
It is CFL but not DCFL.
It is also has equivalent unambiguous CFG.
S→aSa | bSb |  generates the same language.
So, language is Inherently unambiguous language.

Distractor Logic:
DLOA: Regular language is FALSE because no DFA exist.
DLOB: It is inherently unambiguous language because there exist unambiguous grammar.
DLOC: It is not DCFL because no DPDA exist.
DLOD: It is not a finite language.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 19 : PRE‐GATE_2019

27. Create Binary Tree for the given preorder


–/+AB+C D*EF
Then, What is the inorder?
(A) A + B / C + D – E * F (B) A + (B / C) + D – (E * F)
(C) ((A + B) / (C + D)) – (E * F) (D) A + (B / C) + (D – E) * F

27. Ans: (C)


Sol:

/ *

+ + E F

A B C D

In-order: ((A + B) / (C + D)) – (E * F)

Distractor Logic
DLOA: B/C is evaluated First so invalid.
DLOB: A + (B / C) + D → is invalid
DLOC: Refer to solution
DLOD: (A + B) has to be evaluated so parenthesis ( ) should be there.

28. In IEEE standard for floating point numbers, S = sign bit, E = biased exponent, M = Mantissa and
e = true exponent (actual exponent). The values E = 255 and M = 0 in single precision
representation are used to represent
(A) Special value  0 (B) Special value   (infinity)
(C) Special value NAN (Not a number) (D) All of the above

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 20 : CSIT

28. Ans: (B)

Distractor Logic:
DLOA: Option (A) becomes correct answer
when E = 0 and M = 0
DLOB: Correct Answer.
DLOC: Option (C) becomes correct answer
when E = 255 and M  0
DLOD: Option (D) becomes correct answer
when M = 0 or M  0 and E = 0, E = 255

29. A Queue of characters is implemented using a linear array indexed [1….10] and the following
operations are performed on an empty linear queue.
(i) Add A, B, C, D, E, F (ii) Delete two letters
(iii) Add G (iv) Add H
(v) Delete four letters (vi) Add I
What would be the position of rear and front pointers?
[Note: Initially front and rear pointers are at ‘0’]
(A) 9, 4 (B) 9, 7
(C) 8, 5 (D) 3, 9
29. Ans: (B)
Sol:
1 2 3 4 5 6 7 8 9 10
Initial 0

FR

(i) Add A, B, C, D, E, F
1 2 3 4 5 6 7 8 9 10
A B C D E F

F R
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 21 : PRE‐GATE_2019

(ii) Delete ( ) → A
Delete ( ) → B

1 2 3 4 5 6 7 8 9 10
C D E F

\
F R
(iii) Add (G)
(iv) Add (H)

1 2 3 4 5 6 7 8 9 10
C D E F G H

F R

(v) Delete (4) letters → C, D , E , F

1 2 3 4 5 6 7 8 9 10
G H

F R
(vi) ADD (I)

1 2 3 4 5 6 7 8 9 10
G H I

F R
Distractor Logic
DLOA: Rear = 9 correct
But front = 4 invalid
DLOB: Refer to solution
DLOC: Both F and R are wrong
DLOD: Both F and R are wrong

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 22 : CSIT

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 23 : PRE‐GATE_2019

30. What does the following ‘C’ declaration defines?


int (*P[3]) (int, int);
(A) P is an array of three pointers where each pointer is pointing to integer
(B) P is a pointer to array of three integers
(C) P is a function which takes two integer arguments and return type is integer
(D) P is an array of three pointers and each pointer is pointing to function which takes two integer
arguments and return type of function is integer
30. Ans: (D)

Distractor Logic
DLOA: If student assumes that ‘P’ is array of three pointers and each pointer pointing to integer
DLOB: If student assumes that ‘P’ is pointer to array of three integers.
DLOC: If student assumes that ‘P’ is a function.
DLOD: Correct answer

31. Suppose an Operating System uses Virtual Memory with demand paging with Page size of 4KB.
There are 3 frames & initially all frames are empty. FIFO page replacement policy is used.
Consider 2 different programs which initialize all elements to 0. Suppose an array is stored in row
major order, positioned at the start of a page and integer size is 4 bytes.

Program 1 Program 2

int a[6][1024] ; int a[6][1024] ;


for(int j = 0 ; j < 1024 ; ++j) for(int j = 0 ; j < 1024 ; ++j)
{ {
for(int i = 0 ; i < 6 ; ++i) for(int i = 0 ; i < 3 ; ++i)
{ {
a[i][j] = 0 ; a[i][j] = 0 ;
} }
} }

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 24 : CSIT

for(int j = 0 ; j < 1024 ; ++j)


{
for(int i = 3 ; i < 6 ; ++i)
{
a[i][j] = 0 ;
}
}

The difference between the number of page faults occurred in Program 1 and Program 2 are:
(A) 6135 (B) 6138 (C) 6141 (D) 6144
31. Ans: (B)
Sol: Number of pages to store array = array size / page size = (6*1024*4) bytes / 4096 bytes = 6
Let page numbers are P0, P1,…,P5.
First row fits in P0, second in P1 and so on.
Program 1:
Pages are accessed in the sequence of P0, P1, P2, P3, P4, P5, P0, P1…..
With FIFO and 3 frames it will produce 6144 page faults for accessing every element of array.

Program 2:
First for loop: Pages are accessed in the sequence of P0, P1, P2, P0, P1, P2, … (Only 3 Page
Faults)
Second for loop: Pages are accessed in the sequence of P2, P3, P4, P2, P3, P4 …(Only 3 page
Faults)
Total 6 Page Faults.
Difference = 6144 – 6 = 6138

Distractor Logic:
DLOA: Just correct answer – number of frames = 6135, can confuse the student.
DLOB: Refer to solution.
DLOC: Since we have 3 frames, student may think that 6144 – 3 = 6141 may be the answer.
DLOD: Number of page faults in program1 is 6144. The question is difference in page faults of
prog 1 and prog 2.
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 25 : PRE‐GATE_2019

32. Which of the following CFG is ambiguous?


(A) S → Sa | Sb |  (B) S → Sa | Sb | a | b
(C) S → Sa | Sb | ab (D) S → Sa | Sb | a | 
32. Ans: (D)
Sol: S → Sa | Sb | a |  is ambiguous
string ‘a’ has two parse Trees.

Distractor Logic:
DLOA: S →Sa | Sb |  is unambiguous CFG
DLOB: S →Sa | Sb | a | b is unambiguous CFG
DLOC: S →Sa | Sb | ab is unambiguous CFG
DLOD: S →Sa | Sb | a |  is ambiguous CFG

33. Given x, y and z are Boolean variables. Let * be defined as x*y = xy
Let z = x*y then the value of z * x is
(A) y  z (B) y
(C) x (D) y
33. Ans: (B)
Sol: z = xy but given xy = xy so
z = xy = xy = x y  xy → (1)
then z =  x  y  xy  xy → (2)
xy
Now value of z*x = zx = z . x + z . x
 
Sub eqn(1) Sub eqn(2)

z*x = x . y  x yx   x y  x y. x = 0+x.x.y + 0 + x . x .y = x y  x y


 y x  x  = y
z * x = y

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 26 : CSIT

Distractor Logic:
DLOA: Given z = x*y = xy = xy+ x y . If we replace z= xy+ x y then answer is interms
of x, y but not in “z”. Here given option is y  z hence option “A” is wrong.
DLOB: If we perform z*x then answer is “y” hence option “B” is correct.
DLOC: If we perform z*y then answer is “x” but here z*x hence option “C” is wrong.
DLOD: If z = x  y, z =xy then answer is y but z = xy, z =xy hence option “D” is
wrong.

34. Consider the following statements:


S1: Horizontal micro-programmed control unit technique is faster than vertical
micro-programmed control unit technique.
S2: Control word size is larger in vertical micro-programmed control unit than Horizontal
micro-programmed control unit.
S3: Compared to CISC processor, the RISC processor is designed with more number of processing
registers.
S4: CISC processor design uses Hardwired control unit where RISC processor uses
micro-programmed control unit.
S5: Control signal decoders are required for horizontal micro-programmed control unit technique.
The correct statements are
(A) S1, S2, S3, S4 and S5 (B) S1, S2, S3 and S4
(C) S1 and S3 (D) S1, S2 and S5
34. Ans: (C)
Sol:  'S1' is True.
 'S2' is false because Horizontal control word size is larger than vertical micro-programmed
control word.
 S3 is true.
 S4 is false, CISC uses micro-programmed control unit and RISC uses Hardwired control unit
because RISC processor is faster than CISC processor.
 S5 is False because signal decoders are required for vertical micro-programmed control unit but
not for horizontal unit.
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 27 : PRE‐GATE_2019

35. Which of the following algorithm is useful for finding articulation point of a graph?
(A) Straussen’s algorithm (B) Kruskal’s algorithm
(C) Bellman ford algorithm (D) DFS algorithm
35. Ans: (D)
Sol: DFS algorithm is useful for finding articulation point of a graph.

Distractor Logic:
DLOA: Straussen’s algorithm is useful for finding matrix multiplication with O(n2.81)
DLOB: Kruskal’s algorithm is useful for finding MST of a graph
DLOC: Bellman ford algorithm is useful for finding shortest path from source to destination
DLOD: Refer to solution

Q. 36 – Q. 65 carry Two marks each.

36. In an IP(V4) datagram, the value of HLEN (Header length) field is 15 , total length field is 500,
fragmentation offset field is 165 and MF(More Fragment) bit is one. The value in fragmentation
offset field of next IP fragment after this datagram (in sequence) is ______.
36. Ans: 220
Sol: Header length = 15 words = 60 bytes
Total length = 500 bytes
Payload size = (500 – 60) = 440 bytes
Current offset = 165
 Pay load size 
Next offset = (current offset) +  
 8 
 440 
= 165 +   = 165 + 55 = 220
 8 

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 28 : CSIT

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 29 : PRE‐GATE_2019

37. Let the instruction code size is 'X' bits, opcode size is Y bits and each address field size is 'Z' bits.
If 'X' is used for only two address instructions then maximum number of instructions to be
formulated is 64 and if same 'X' is used for only one address instruction, then the maximum
number of instructions to be formulated is 2048. Size of 'Z' in bits is ______.
37. Ans: 5 No range
Sol: Instruction code size = X bits.
Two address instruction format

Y Z Z
Opcode Address Address

 2Y = 64 = 26, Y = 6
One address instruction format

Y+Z Z
Opcode Address

2Y+Z = 2048 = 211


Y + Z = 11, so, Z = 5
Opcode size = 6 bits, each address field size = 5 bits, and X = 6 + 5 + 5 = 16 bits

38. Let S = {a, b, c, d, e}. Number of strings of length 5 possible with the letters of S, so that atleast
two a's are consecutive is ______.
38. Ans: 421 No range
Sol: Number of strings of length 5 possible with the letters of S = 55 = 3125
Let us calculate number of strings of length 5, with no two consecutive a's.
Case 1: Number of strings without letter a = 45 = 1024
Case 2: Number of strings with one a = C(5, 1).44 = 1280
Case 3: Number of strings with two separated a's = C(4, 2). 43 = 384
Case 4: Number of strings with three separated a's = C(3, 3). 42 = 16
 Required number of strings = 55 – (1024 + 1280 + 384 + 16) = 421

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 30 : CSIT

39. Suppose an Operating System uses Multilevel Feedback Queue CPU scheduling. Assume that
there are 3 ready queues namely A, B and C. Round Robin algorithm is applied on each queue
with Time Quantum of 2, 3 and 6 milliseconds respectively.
When a process arrives it is queued to A. Once it has given a time quantum, it is put in the next
queue B and then to C which is the last queue. Each queue is given 6 milliseconds for scheduling
its processes, in round robin fashion of A-B-C.
Consider the following processes:

Process Arrival Time Burst Time

P1 4 5

P2 1 7

P3 0 14

P4 7 10

The average Turnaround Time is _______ milliseconds.


39. Ans: 26.5
Sol: Gantt chart:
Departure:
P1 P2 P3 P4

CPU P3 P2 P1 P3 P2 P3 P4 P1 P4 P2 P3 P4

01 2 4 6 7 9 12 18 20 23 26 28 31 36
Arrival: P3 P2 P1 P4

(23  4)  (28  1)  (31  0)  (36  7)


Average TAT 
4
 26.5

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 31 : PRE‐GATE_2019

40. Consider the following sequential circuit with Initial state Q2 = Q1= Q0 = 0 as shown below

Q0 Q2
J2 Q2 J1 Q1 J0 Q0

1 1
K2 Q2 K1 Q1 K0 Q0
Clock

The Modulus (MOD) of above counter is ____________.


40. Ans: 5
Sol: From circuit we can write
J2 = Q1 Q0; J1 = Q0 ; J0= Q2
K2 = 1 ; K1 = Q 0 ; K0 = 1
Given Q2 = Q1= Q0= 0 Initially

JK flip-flop Truth Table

J K Qn+1
0 0 Qn
0 1 0
1 0 1
1 1 Qn

Input, output relation Table

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 32 : CSIT

Clock J2 K2 J1 K1 J0 K0 Q2 Q1 Q0
0 - - - - - - 0 0 0
1 0 1 0 0 1 1 0 0 1
2 0 1 1 1 1 1 0 1 0
3 0 1 0 0 1 1 0 1 1
4 1 1 1 1 1 1 1 0 0
5 0 1 0 0 0 1 0 0 0 → Initial state repeating

After “5” clock pulses Initial state is repeating hence it is a MOD-5 counter.

41. An Operating system uses multilevel paging for non-contiguous memory allocation with Logical
Address of 35 bits. Page size at all levels is 1KB and Page Table Entry size at all levels is 4B. The
number of level(s) of paging required such that outer page table can be stored in one frame of
Physical Address Space with Physical Address of 33 bits, is ______ .
41. Ans: 4
Sol: Main Page Table: (1st level page table):
Number of entries = No. of pages
LAS

Page Size
= 235/210 = 225
 Size of P.T. = 225  4B = 227 B

2nd level Page Table:


2 27
# Entries  10
 217
2
 Size of P.T. = 217  4B = 219 B

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 33 : PRE‐GATE_2019

3rd level Page Table:


219
# Entries   29
210
 Size of P.T. = 29  4B = 211 B
4th level Page Table:
211
# Entries  2
210
 Size of P.T. = 2  4 = 8 B

Can be stored in one frame
(or Page)

42. A cache memory size is 64 KB with 8 way block set associative model and 512 bytes in each
cache line. The word length is 64 bits and size of physical address space is 16 GB. The number of
bits for the tag field is ______.
42. Ans: 21
Sol: Size of cache memory = 216 Bytes
Associativity = 8 way
Size of main memory = 234 Bytes
Size of tag field for direct mapped cache = PA – CA
PA = Physical Address = 34 bits
CA = Cache Address = 16 bits
Size of tag field for 8 way block set associative cache design = PA – CA + log2 8 = 34 – 16 + 3 = 21

43. Consider an instruction pipeline with five stages without any branch prediction; Instruction fetch
(IF), Instruction Decode (ID), Operand Fetch (OF), Perform Operation or Execute (PO or EX) and
Write Operand (W.O). The stage delays for IF, ID, OF, PO and WO are 4 ns, 3 ns, 8 ns, 10 ns and
6 ns, the intermediate storage buffer register delay after each stage is negligible. A program
consisting of 15 instructions (I1 to I15) is executed in this pipelined processor. The instruction I5 is
the only branch instruction and it's branch target is I10. If branch is taken during the execution of
this program, the time (in ns) needed to complete the program is ______.
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 34 : CSIT

43. Ans: 180


Sol: Number of segments = 5 (k)
Number of instructions to be executed = 11 (n)
(I1 to I5 and I10 to I15)
Maximum Tseg = 10 ns.
Tp/program = (n + k – 1)  Tseg, but since branch prediction is not available, three stage delays are
occurred while executing I5 instruction (i.e. until completion of I5 in PO. stage processor does not
know the target address i.e. I10 address).
 Total time = Tp/program + delay time for I5
= (n + k – 1)  Tseg + Delay time
= (11 + 5 – 1)  10 ns + (3  10 ns)
= 150 ns + 30 ns = 180 ns

44. The number of spanning trees are possible to the following undirected weighted graph is____.

A B E

C D

44. Ans: 21
Sol: Total number of edges required for constructing Spanning Tree are 4. So we have to choose 4
edges from given 7 edges. But whatever edges we have chosen those edges are forming tree and
spans all vertices of graph.
So, total number of spanning trees are possible
= 7C4 – [Total number of cycles forming with either ‘3’ edges (or) ‘4’ edges]
= 35–14
= 21

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 35 : PRE‐GATE_2019

45. Consider the following transactions:


T1: R1(A) W1(A) R1(B) W1(B)
T2: R2(A) W2(A) R2(C) W2(C)
The number of conflict serializable schedules that can be formed over T1 and T2 is ______.
45. Ans: 30

Sol: The number of concurrent schedules possible =


4  4 ! = 70
4 !* 4 !
 If W2(A) appears between R1(A) and W1(A) make the schedules possible are not conflict
serializable.
The number of concurrent schedules possible where W2(A) appears between R1(A) and W1(A)
is 20.
 Similarly the number of concurrent schedules possible where W1(A) appears between R2(A)
and W2(A) = 20.
 Total not conflict serializable schedules = 20 + 20 = 40
 Number of conflict serializable schedules = 70 – 40 = 30.

46. Let S = {a, b, c, d} and a relation R on S is defined by


R = {(a, b), (a, c), (a, d), (b, b), (c, a), (d, b), (d, c)}.
The number of ordered pairs in the transitive closure of R is ______.
46. Ans: 13 No range
Sol: The given relation can be represented by the following digraph.

c d

b
a

From the vertex a, there are directed paths to the vertices a, b, c and d.
 The transitive closure of R contain the ordered pairs (a, a), (a, b), (a, c) and (a, d).
From the vertex b, there are directed paths to only vertex b.
 The transitive closure of R contain the ordered pairs (b, b).

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 36 : CSIT

From the vertex c, there are directed paths to the vertices a, b, c and d.
 The transitive closure of R contain the ordered pairs (c, a), (c, b), (c, c) and (c, d).
From the vertex d, there are directed paths to the vertices a, b, c and d.
 The transitive closure of R contain the ordered pairs (d, a), (d, b), (d, c) and (d, d).
Hence, number of ordered pairs in the transitive closure of R = 4 + 1 + 4 + 4 = 13

47. On the average 15 cars pass a certain point on a road per hour. The probability that exactly four
cars pass through the point in a 12 minute period is ________
47. Ans: 0.168 Range 0.1 to 0.2
Sol: Let us use Poisson distribution.
15
Average number of cars passing through the point in a 12 minute period = 3
 60 
 
 12 
=3
By Poisson distribution,
e   .k
P(X = k) =
k!

e 3 .34
 The Required probability = P(X = 4) = = 0.168
4!

48. Find the grammar which is L-attributed but not S-attributed grammar?
(A) S → Aa {S.x = A.x} (B) S →AB {B.x = A.x}
A → b {A.x = 10} A →a {A.x = 10}
B →b {B.x =20}

(C) S → AB {S.x = A.x+B.x} (D) S →AB {A.x = B.x}


A→a {A.x =10} A →a {A.x = 10}
B→b {B.x =20} B→ b {B.x = 20}

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 37 : PRE‐GATE_2019

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 38 : CSIT

48. Ans: (D)


Sol: • L-attributed grammar has attributes where attribute value at any node depends on parsing left
siblings of children
 S-attributed grammar has attributes where attribute value at any node depends on children

Distractor Logic:
DLOA: It is S-attributed grammar & L-attributed grammar.
DLOB: It is S-attributed & L-attributed grammar.
DLOC: It is neither L-attributed nor S-attributed grammar.
DLOD: It is L-attributed grammar but not S-attributed.

49. int x = 5;
void f1(int y)
{
y = y + x;
printf(“%d”, y);
}
void f2(int *ptr)
{
x = *ptr + 1;
f1(x);
*ptr = x – 1;
printf(“%d”, x);
}
void main( )
{
x = 7;
f2(&x);
printf(“%d”, x);
}

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 39 : PRE‐GATE_2019

What is the output of the above program?


(A) 16, 7, 7 (B) 15, 8, 7
(C) 13, 8, 7 (D) 15, 8, 8
49. Ans: (A)
Sol: Step 1: Update global variable ‘x’ with ‘7’ from function main( )
Step 2: call function f2( ) by passing address of global variable from the function main( )
Step 3: Update global variable with value *ptr+1 i.e. 8
Step 4: Pass value of global variable to function f1( )
Step 5: In the function f1( ), the expression y = y + x gives the output is 16
Step 6: Update global variable value with 7 in f2( ) and then print global variable value as 7
Step 7: Print global variable value as 7 from main( ) so the output of above program is 16, 7, 7

Distractor Logic
DLOA: Refer to solution
DLOB: If student assumes that the function f2( ) has local variable as ‘x’ then output is 15, 8, 7
DLOC: If student assumes that the function and main function has local variable ‘x’ then output is
13, 8, 7
DLOD: If student assumes that the function f2( ) has local variable as ‘x’ and he forgot to update
value of *ptr = x – 1 then output is 15, 8, 8.

50. Consider group of 5 routers A, B, C, D and E are connected, router C have direct connectivity with
routers A and D, with distance 3 and 8 respectively. All routers uses distance vector routing and
during round of update process, routers A and D send their following distance vector to router C.

Router A  A B C D E
0 6 3 2 1

Router D  A B C D E
2 4 5 0 3

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 40 : CSIT

What is the updated distance vector at router C?

A B C D E A B C D E
(A) (B)
3 9 0 8 4 3 12 0 5 4

A B C D E A B C D E
(C) (D)
3 9 0 5 4 3 12 0 8 4

50. Ans: (C)


Sol:
Router A  3 A B C D E
0 6 3 2 1

Router D  8 A B C D E
2 4 5 0 3

Router D  A B C D E
(3 + 0) (3 + 6) 0 (3 + 2) (3 + 1)

Distractor Logic
DLOA: Connectivity to B through A & connectivity to D is direct
DLOB: Connectivity to B through D & connectivity to D is through A
DLOC: Refer to solution
DLOD: Connectivity to B through D & connectivity to D is direct

51. Consider the following languages.


L1= Recursive language
L2 = Recursively Enumerable language
L3 = Semidecidable language
L3  L2 – L1 is
(A) Recursive language (B) Semidecidable language
(C) Recursively Enumerable language (D) Not countable
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 41 : PRE‐GATE_2019

51. Ans: (C)


Sol: L3  L2 – L1 = L3  L2  L1 = SD  REL  Recursive = (SD  REL)  Recursive

= REL  Recursive = REL

Distractor Logic:
DLOA: L3  L2 – L1 is need not be Recursive language.
DLOB: L3  L2 – L1 is need not be Semidecidable language.
DLOC: L3  L2 – L1 is REL.
DLOD: L3  L2 – L1 is countable.

52. Consider the following C program.


If T(n) = Number of times abc(n) is being called then which of the following is valid recurrence
equation for computing number of times abc(n) is being called.
void abc(int n)
{
if(n < = 1)
return;
abc(n – 1);
abc(n– 2);
printf(“%d”, n);
}
(A) T(n) = 1 + T(n – 1) + T(n – 2) , if n > 1
= 1, if n < = 1
(B) T(n) = 1 + T(n – 1), if n > 1
= 1, if n < = 1
(C) T(n) = 1 + T(n – 2), if n > 1
= 1, if n < = 1
(D) T(n) = T(n – 1) + T(n – 2) if n > 1
=1 if n < 1

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 42 : CSIT

52. Ans: (A)


Sol: If T(n) = Number of times abc(n) is being called
T(n –1) = Number of times abc(n – 1) is being called
T(n –2) = Number of times abc(n –2) is being called
 T(n) = 1 + T(n – 1) + T(n – 2) if n > 1
In this equation ‘1’ represent the first calls from
T(n) = 1 + T(n – 1) + T(n–2) if n > 1
=1 if n < = 1

Distractor Logic
DLOA: Refer to solution
DLOB: If student consider only abc(n – 1) and neglect abc(n – 2) then option (B) is correct
DLOC: If student consider only abc(n–2) and neglect abc(n – 1) then option (C) is correct
DLOD: If student forgot to count first function then option (D) is correct

53. Consider the following 3-address code


x=a+b
x = x+c
x = x+d
Find the SSA code for the above 3-address code?
(A) x = a+b ; y = x+c ; x=y+d
(B) a = a+b ; a = a+c ; a=a+d
(C) x = a+b ; y = x+c ; z=x+d
(D) x = a+b ; y = x+c ; z=y+d
53. Ans: (D)
Sol: SSA code has variables where each variable has single assignment.
x = a+b; x= x+c; x=x+d (3-Address code)
 x= a+b; y=x+c; z=y+d (SSA code)

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 43 : PRE‐GATE_2019

Distractor Logic:
DLOA: x has 2 assignments.
DLOB: a has 4 assignments
DLOC: It is SSA code but not equivalent to given 3-Address code.
DLOD: It is SSA code for the given 3-Address code.

54. Let P(x) denote the predicate 'x is a prime number', and universe of discourse is set of all integers.
Consider the statement
"For every integer n bigger than 1, there is a number which is prime and strictly between n and
2n".
Which of the following first order logic sentences, correctly represent negation of the above
statement?
(A) n {(n > 1)  x (P(x)  (n < x < 2n))}
(B) n {(n > 1)  x (P(x)  ((x  n)  (x  2n)))}
(C) n {(n > 1)  x (P(x)  (n < x < 2n))}
(D) n {(n > 1)  x (P(x)  ((x  n)  (x  2n)))}
54. Ans: (B)
Sol: The first order logic sentence, that is equivalent to given statement is
n {(n > 1)  x (P(x)  (n < x < 2n))}
By the rule of negation, the negation of the above formula can be written as
n {(n > 1)  x (P(x)  ((x  n)  (x  2n)))}
 Option (B) is correct.

Distractor Logic
DLOA: The formula in option (A) correctly represents the given statement, but we want the
negation of the given statement.
DLOB: Refer to solution
DLOC: The formula given in option (C) is false, because universe of discourse is set of all
integers.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 44 : CSIT

DLOD: The universal quantifier takes the connective , where as the existential quantifier take
the connective . Therefore, option (D) is false.

55. If the perfect Binary heap tree of height ‘h’ containing 2h+1 –1 nodes, then the sum of the heights of
the nodes is
(A) 2h+1 –1 (B) 2h
(C) (2h+1 –1) – (h+1) (D) h+1
55. Ans: (C)
Sol: In the perfect Binary heap tree, we have 2i nodes at height h–i.
Then the sum of heights of all the nodes is
h
S   2i ( h  i )
i0

S = h+2(h–1) + 4(h–2) + 8(h–3) + 16(h–4) + --+2h–1(1)------(1)


Multiplying equation ------(1) by 2 gives
2S = 2h+4(h–1)+8(h–2)+16(h–3)+ --------+ 2h ------------(2)
By performing eqn (2) – eqn (1)
S = – h + 2 + 4 + 8 + ---+ 2h-1 + 2h
= (2h+1 –1) – (h+1) [∵By using Geometric progression]

Distractor Logic:
DLOA: If student computes maximum number of nodes in perfect binary heap tree then option
(A)
DLOB: If student computes minimum number of nodes in perfect binary heap tree then option
(B)
DLOC: Refer to solution
DLOD: If student computes number of nodes in a path from root to any leaf.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 45 : PRE‐GATE_2019

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 46 : CSIT

56. Supplier (sid, sname, rating)


Supply(sid, partid)
Parts(partid, partname, color)
Consider the following query on the schema above.
Select sname
From Supplier
Where (Select partid
From Supply
Where Supplier.sid = Supply.sid)
Contains
(Select partid From parts Where color = 'Blue');
The above query finds name of the supplier who supplies
(A) atleast one blue part (B) all blue parts
(C) none of the blue parts (D) atmost one of the blue parts
56. Ans: (B)
Sol: A contains B returns true if B  A.
First inner query returns partid of parts supplied by each supplier. Second inner query returns
partid of parts whose color = ‘Blue’.

Distractor Logic:
DLOA: If student thinks A contains B returns true if A  B, then option (A) is correct.
DLOB: Refer to solution.
DLOC: Because first inner query not contains a condition of color = blue, student may get option
(C).
DLOD: Because A contains B returns true if B  A, it will never be true.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 47 : PRE‐GATE_2019

57. A sorting technique is said to be stable if keys that are equal retain their relative orders of
occurrence even after sorting. Consider the following statements and which of these statements are
TRUE?
I. Bubble sort is stable and insertion sort is unstable
II. Bubble sort, Insertion sort are stable and selection sort is unstable
III. Merge sort is stable and Quick sort is unstable
IV. Heap sort is stable.
(A) Only I (B) Only II, IV
(C) Only II, III (D) Only I, IV
57. Ans: (C)
Sol: Bubble sort, Insertion sort, Merge sort are stable where as Selection sort, Quick sort, Heap sort are
unstable.
Consider the unordered list L = {71, 72, 73, 6}
The repeating keys have been distinguished using their order of occurrence as super scripts. The
partially sorted list at the end of each pass of bubble sort are
Pass 1: {71, 72, 73, 6}
Pass 2: {71, 6, 72, 73}
Pass 3: {6, 71, 72, 73}
Observe that how equal keys 71, 72, 73 maintain their relative order of occurrence in the sorted list
as well, hence stability is verified.
Similarly Insertion sort and merge sort satisfies stability
Selection sort
Consider the list L= {61, 62, 2}, the repeating keys have been superscripted with numbers
indicative of their relative order of occurrence. A trace of the selection sort procedure is shown
below.
Pass List L (During pass) List L (After pass)

1 {61, 62, 2} {2, 62, 61}

2 {2, 62, 61} {2, 62, 61} (Sorted list)

The selection sort on the given list ‘L’ is therefore not stable.
ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad
: 48 : CSIT

Distractor Logic:
DLOA: If student thinks only Bubble sort is stable
DLOB: If student thinks Heap sort is also stable
DLOC: Refer to Solution
DLOD: If student thinks bubble sort and heap sort are stable

58. Identify context free language which is not deterministic CFL


(A) {wwR a | w (a+b)*, wR is reverse of w}
(B) {a wwR | w (a+b)*, wR is reverse of w}
(C) {a wwR b | w (a+b)*, wR is reverse of w}
(D) All of the above
58. Ans: (D)

Distractor Logic:
DLOA: {wwR a | w (a+b)*} is CFL but not DCFL
DLOB: {a wwR | w (a+b)*} is CFL but not DCFL
DLOC: {a wwR b | w (a+b)*} is CFL but not DCFL
DLOD: Correct answer

2, for n  0
59. If f n    , then f(100) = _______.
3  2 f n  1, for n 1
(A) f(n) = 5(2100) – 3 (B) f(n) = 5(2100) + 3
(C) f(n) = 3(2100) – 5 (D) f(n) = 3(2100) + 5
59. Ans: (A)
Sol: f(n) = 2f(n – 1) + 3
 f(n + 1) – 2f(n) = 3
 (E – 2) f(n) = 3 where E is shift operator
The characteristic equation is t – 2 = 0  t = 2
The complementary function = C1. 2n

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 49 : PRE‐GATE_2019

3  1n 
Particular solution = = 3  
E2  E 2

 1n 
= 3   By replacing E with 1
1 2 
= –3
 The solution is f(n) = C1.(2n) – 3
Using initial condition f(0) = 2, we have
2 = C1 – 3  C1 = 5
 The solution is f(n) = 5(2n) – 3
Hence, f(100) = 5(2100) – 3

60. Let L1  L2 and L2  L3.


L1, L2, and L3 are known to be Recursively enumerable languages. If L3 is decidable language then
which of the following statement is TRUE?
(A) L1 is decidable and L2 is undecidable
(B) L1 is undecidable and L2 is decidable
(C) L1 and L2 are decidable languages
(D) None of these
60. Ans: (C)
Sol: L1  L2 and L2  L3
L3 is decidable  L2 is decidable
L2 is decidable  L1 is decidable
So L1 and L2 are decidable languages.

Distractor Logic:
DLOA: L1 is Decidable and L2 is not undecidable.
DLOB: L1 is not undecidable and L2 is decidable.
DLOC: L1 and L2 are decidable languages.
DLOD: Because option (C) is correct, none is incorrect.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 50 : CSIT

61. Solution to the recurrence equation


T(n) = nT  n   100n , if n>2
= 2, if n  2
(A) (n) (B) (nloglogn)
(C)   n (D) (n2)
61. Ans: (B)

Sol: Let S(n) 


T(n )
n
then the given recurrence equation becomes S(n) = S n  100  
 
S(n) = S n  100

= S n   100  100


 

 212 
 S n   100  100
 
By continuing this process
 2k 1 
1

S(n )  S n  +(k–1)100 -----(*)


 
 
1
2 k 1
Let n 2
2k 1  log 2 n
k  1  log 2 log 2 n
k  log 2 log 2 n  1
from equation ----(*)
S(n) = S(2) + 100 log2 log2n
S(n) = 1+100 log2 log2n
T(n) = n(1+100 log2 log2n)
= (nlog2 log2n)

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 51 : PRE‐GATE_2019

Distractor Logic:
 
DLOA: If student thinks T(n) = n T n  100n is bounded by (n)
DLOB: Refer to solution
DLOC: If student thinks T(n) =  
n T n  100n is bounded by  n  
DLOD: If student thinks T(n) = n T  n   100n is bounded by (n ) 2

62. What does the following ‘C’ routine do on binary tree?


struct BTNode
{
struct BTNode * LeftChild;
int data;
struct BTNode * RightChild;
}
int Do(struct BTNode * t)
{
if (!t)
return 0;
if (t → LeftChild = = NULL && t → RightChild = = NULL)
return 0;
else
return Do(t → LeftChild) + Do(t → RightChild) +1;
}
(A) The number of leaf nodes in the tree
(B) The number of nodes in the tree
(C) The total number of internal nodes in the tree
(D) The total number of nodes with 2 children

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 52 : CSIT

62. Ans: (C)


Sol:
3
Tracing 1+ 1 + 1 a

1+ 0 + 0 b 1+ 0 + 0 d

c e f

Distractor Logic
DLOA: in a ‘C’ rotuine
if(! t → LeftChild & & ! t → RightChild)
return 1;
then it count leaves
DLOB: if (t → LeftChild = = NULL && t → RightChild = = NULL)
return 0;
Should not be there to get number of nodes.
DLOC: Refer to solution
DLOD: Checking for 2 children is not there

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 53 : PRE‐GATE_2019

63. Consider the following pseudocode, what is the output if the variables are static scope values?
begin
integer m, n;
procedure P(n: integer)
begin
procedure Q;
begin
print(n);
end;
print(m);
print(n);
Q;
end
m : = 50;
n : = 100;
print(n);
P(1);
end
(A) 100, 1, 50, 100 (B) 100, 50, 1, 100
(C) 100, 50, 1, 1 (D) 100, 1, 50, 1
63. Ans: (C)
Sol: In static scope, reference of any variable will be resolved by using principle is first give preference
to local variable, if local variable is not available then give preference to most recent ancestor
variable reference.
Step 1: Initially m = 50, n = 100, so print(n) in main program will print the value of ‘n’ as 100
Step 2: In procedure ‘P’ the statements print(m) will print 50 and print(n) will print 1
Step 3: In procedure Q, print(n) will print 1

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 54 : CSIT

Distractor Logic
DLOA: If student executes print(n) in Q, before the execution of print(m), print(n) in P then
option (A) is correct.
DLOB: If student forget to update value of ‘n’ with ‘1’ in procedure ‘Q’ then option (B) is correct
DLOC: Refer to Solution
DLOD: If student executes print(n) in Q before execution of print(m), print(n) in ‘P’ and he
updated value of ‘n’ with ‘1’ in procedure ‘P’ then output is option (D)

64. Consider a Producer-Consumer problem of synchronization. A producer produces items one by


one and puts in a shared buffer of size N. Consumer needs 2 items from buffer to do its job. There
are two counting semaphores S1 and S2. There is one Binary semaphore mutex initialized to 1.
DOWN and UP are the standard semaphore operations. What should be the initial values of S1 and
S2, in order to work this solution properly?

Producer Consumer
int in = 0, itemp; int out = 0, itemc1, itemc2;
while(1) while(1)
{ {
Produce-item(itemp) ; DOWN (S2) ;
DOWN (S1) ; DOWN (S2) ;
DOWN (m1) ; DOWN (m1) ;
buffer[in] = itemp ; in = (in+1) mod N ; itemc1 = buffer[out] ; out = (out+1) mod N ;
UP (m1) ; itemc2 = buffer[out] ; out = (out+1) mod N ;
UP (S2) ; UP (m1) ;
} UP (S1) ;
UP (S1) ;
Consume-items(itemc1, itemc2);
}

(A) S1 = N, S2 = 2 (B) S1 = 2, S2 = N
(C) S1 = N, S2 = 0 (D) S1 = 0, S2 = N

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 55 : PRE‐GATE_2019

64. Ans: (C)


Sol: If the consumer starts first, it should be blocked. So initial value of S2 must be 0.
If there is one item in buffer, still consumer will be blocked by second DOWN operation on S2.
Producer can produce N items if consumer is not started yet. So initial value of S1 should be N.
Distractor Logic:
DLOA: S1=N is correct but S2=2 is wrong. Student may think that, as 2 items are needed
by consumer, the initial value of S2 should be 2.
DLOB: S1 = 2 is wrong. Its not that producer can produce 2 items and will stop after that. It
can produce N items at max. So S1 must be N.
S2=2 is also wrong as explained in option (A)
DLOC: Refer to solution
DLOD: If S1 is initially 0, then how can a producer produce item. DOWN(S1) will make S1
as –1, and producer will be blocked forever, creating a deadlock.

65. Consider the following operator precedence grammar


S → S+T
S→F
T→T*F
T→F
F → id
Which of the following precedence relation cannot be derived from the above grammar?
(A) + is left associative (B) * is left associative
(C) + has highest precedence (D) * has highest precedence
65. Ans: (C)
Sol: S → S+T|F
T → T*F|F
F → id
+ is left associative because S → S+T is left recursive
* is left associative because T → T*F is left recursive
* has highest precedence S → S+T  S+(T*F)

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad


: 56 : CSIT

Distractor Logic:
DLOA: + is left associative, it can be derived from S → S + T.
DLOB: * is left associative, it can be derived from T → T * F.
DLOC: + has lowest precedence.
DLOD: * has highest precedence.

ACE Engineering Academy Hyderabad|Delhi|Bhopal|Pune|Bhubaneswar|Lucknow|Patna|Bengaluru|Chennai|Vijayawada|Vizag|Tirupati|Kukatpally|Kolkata|Ahmedabad

You might also like