Professional Documents
Culture Documents
Csit Pre-Gate 2019
Csit Pre-Gate 2019
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
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)
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.
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
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
3
side length
2
Volume of the top portion = Area × length =
4
=
4
3
2
2 3 10 30 3 52cm 3
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
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%
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%
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
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
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
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
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
19. Find the equivalent Regular Expression for the following regular expression.
(a+b)* ab (a+b)*
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
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)
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
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.
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.
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
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.
/ *
+ + E F
A B C D
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
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
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
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
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
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 = xy
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 = xy but given xy = xy so
z = xy = xy = x y xy → (1)
then z = x y xy xy → (2)
xy
Now value of z*x = zx = z . x + z . x
Sub eqn(1) Sub eqn(2)
Distractor Logic:
DLOA: Given z = x*y = xy = 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 =xy then answer is y but z = xy, z =xy hence option “D” is
wrong.
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
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
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
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
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:
P1 4 5
P2 1 7
P3 0 14
P4 7 10
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
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
J K Qn+1
0 0 Qn
0 1 0
1 0 1
1 1 Qn
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
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
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
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).
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}
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);
}
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
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
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
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.
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
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.
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 )
i0
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.
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.
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)
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
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
3 1n
Particular solution = = 3
E2 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
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.
212
S n 100 100
By continuing this process
2k 1
1
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
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
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
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)
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
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.