GATE 2016 set2
Question 1 
The man who is now Municipal Commissioner worked as _______________.
the security guard at a university  
a security guard at the university  
a security guard at university  
the security guard at the university 
And coming to university it is an organization.
So we use are 'the' before university.
Question 2 
Nobody knows how the Indian cricket team is going to cope with the difficult and seamerfriendly wickets in Australia.
Choose the option which is closest in meaning to the underlined phrase in the above sentence.
put up with  
put in with  
put down to  
put up against 
→ Cope with is doesn't means that put someone into competition with some other.
Question 3 
Find the odd one in the following group of words.

mock, deride, praise, jeer
mock  
deride  
praise  
jeer 
Deride = express contempts for; ridicule
Jeer = Make rude and mocking remarks
→ These three are negative things
Praise = express warm approval
Question 4 
Pick the odd one from the following options.
CADBE  
JHKIL  
XVYWZ  
ONPMQ 
But in D, 2nd and 4th are in decreasing order.
Question 5 
n^{4}  
4^{n}  
2^{2n1}  
4^{n1} 
Product of roots (α, β) = 4
⇒ αβ = 4
(αβ)^{n} = 4^{n}
Question 6 
Among 150 faculty members in an institute, 55 are connected with each other through Facebook^{®} and 85 are connected through WhatsApp^{®}. 30 faculty members do not have Facebook^{®} or WhatsApp^{®} accounts. The number of faculty members connected only through Facebook^{®} accounts is ______________.
35  
45  
65  
90 
Number of faculty members connected through Facebook = 55
Number of faculty members connected through Whatsapp = 85
Number of faculty members with Facebook (or) Whatsapp accounts = 30
Number of faculty members with either Facebook (or) Whatsapp accounts = 150  30 = 120
Number of faculty members with both Facebook and Whatsapp accounts = 85 + 55  120 = 20
Number of faculty members with only Facebook accounts = 55  20 = 35
Question 7 
Computers were invented for performing only highend useful computations. However, it is no understatement that they have taken over our world today. The internet, for example, is ubiquitous. Many believe that the internet itself is an unintended consequence of the original invention. With the advent of mobile computing on our phones, a whole new dimension is now enabled. One is left wondering if all these developments are good or, more importantly, required.
Which of the statement(s) below is/are logically valid and can be inferred from the above paragraph?

(i) The author believes that computers are not good for us.
(ii) Mobile computers and the internet are both intended inventions.
(i) only  
(ii) only  
both (i) and (ii)  
neither (i) nor (ii) 
So, statement I does not follow.
→ "Many believes that the internet itself is unintended consequence of the original invention.
So, statement II does not follow, so Answer is Option D.
Question 8 
All hillstations have a lake. Ooty has two lakes.
Which of the statement(s) below is/are logically valid and can be inferred from the above sentences?

(i) Ooty is not a hillstation.
(ii) No hillstation can have more than one lake.
(i) only  
(ii) only  
both (i) and (ii)  
neither (i) nor (ii) 
All hillstations have a lake → (1)
Ooty has two lakes → (2)
From (1), it cannot be inferred that every place having a lake is a hill station.
⇒ (i) cannot be logically intended.
From (1), it cannot be inferred how many lakes will be there in a hill station.
⇒ (ii) cannot be logically inferred.
Question 9 
In a 2 × 4 rectangle grid shown below, each cell is a rectangle. How many rectangles can be observed in the grid?
21  
27  
30  
36 
Question 10 
f(x) = 1  x  1  
f(x) = 1 + x  1  
f(x) = 2  x  1  
f(x) = 2 + x  1 
x = 1 ⇒ f(x) = 0
x = 0 ⇒ f(x) = 1
We have check, which option satisfies both the conditions.
Only option (C) satisfies both of them.
Question 11 
Consider the following expressions:

(i) false
(ii) Q
(iii) true
(iv) P ∨ Q
(v) ¬Q ∨ P
The number of expressions given above that are logically implied by P ∧ (P ⇒ Q) is _________.
4  
5  
6  
7 
(P ∧ (P → Q))→ expression is a tautology. So we have to find
How many tautological formulas are there for the given inputs.
(P ∧ (P → Q)) → True is always tautology
(P ∧ (P → Q)) → False is not a tautology
(P ∧ (P → Q)) → Q is a tautology
(P ∧ (P → Q)) → ¬Q ∨ P is a tautology
(P ∧ (P → Q)) → P ∨ Q is a tautology
So there are 4 expressions logically implied by (P ∧ (P → Q))
Question 12 
Let f(x) be a polynomial and g(x) = f'(x) be its derivative. If the degree of (f(x) + f(x)) is 10, then the degree of (g(x)  g(x)) is __________.
9  
10  
11  
12 
It is given that f(x) + f(x) degree is 10.
It means f(x) is a polynomial of degree 10.
Then obviously the degree of g(x) which is f’(x) will be 9.
Question 13 
The minimum number of colours that is sufﬁcient to vertexcolour any planar graph is ________.
4  
5  
6  
7 
Here it is asked about the sufficient number of colors, so with the worst case of 4 colors we can color any planar graph.
Question 14 
Consider the systems, each consisting of m linear equations in n variables.

I. If m < n, then all such systems have a solution
II. If m > n, then none of these systems has a solution
III. If m = n, then there exists a system which has a solution
Which one of the following is CORRECT?
I, II and III are true  
Only II and III are true  
Only III is true  
None of them is true 
(B) If number of equations are less than number of unknowns, then it has infinite solutions.
(C) If number of equations are greater than number of unknown, it is over determined system, then it is inconsistent.
Example:
Consider equations with two unknowns (x, y).
(A) x+y = 10
xy = 6
Single solution
(B) y = 3x
Infinite solution
(C) x+y = 10
xy = 4
x+3y = 15
x3y = 6
Inconsistent
Question 15 
Suppose that a shop has an equal number of LED bulbs of two different types. The probability of an LED bulb lasting more than 100 hours given that it is of Type 1 is 0.7, and given that it is of Type 2 is 0.4. The probability that an LED bulb chosen uniformly at random lasts more than 100 hours is _________.
0.55  
0.56  
0.57  
0.58 
The bulbs of Type 1, Type 2 are same in number.
So, the probability to choose a type is 1/2.
The probability to choose quadrant ‘A’ in diagram is
P(last more than 100 hours/ type1) = 1/2 × 0.7
P(last more than 100 hours/ type2) = 1/2 × 0.4
Total probability = 1/2 × 0.7 + 1/2 × 0.4 = 0.55
Question 16 
Suppose that the eigenvalues of matrix A are 1, 2, 4. The determinant of (A^{1})^{T} is _________.
0.125  
0.126  
0.127  
0.128 
Given that eigen values are 1, 2, 4.
So, its determinant is 1*2*4 = 8
The determinant of (A^{1})^{T} = 1/ A^{T} = 1/A = 1/8 = 0.125
Question 17 
Consider an eightbit ripplecarry adder for computing the sum of A and B, where A and B are integers represented in 2’s complement form. If the decimal value of A is one, the decimal value of B that leads to the longest latency for the sum to stabilize is _________.
1  
2  
3  
4 
If we do 2's complement of 1 = 0000 0001, we get 1 = "1111 1111"
So, if B = 1, every carry bit is 1.
Question 18 
Let, x_{1}⊕x_{2}⊕x_{3}⊕x_{4} = 0 where x_{1}, x_{2}, x_{3}, x_{4} are Boolean variables, and ⊕ is the XOR operator. Which one of the following must always be TRUE?
x_{1}x_{2}x_{3}x_{4} = 0  
x_{1}x_{3}+x_{2} = 0  
x_{1} + x_{2} + x_{3} + x_{4} = 0 
(x_{1}⊕x_{3})⊕(x_{2}⊕x_{4}) = 0
x_{1}⊕x_{3} = x_{2}⊕x_{4}
[Since a⊕a=0]
[a⊕b=a'⊕b']
Question 19 
Let X be the number of distinct 16bit integers in 2’s complement representation. Let Y be the number of distinct 16bit integers in sign magnitude representation.
Then XY is _________.
1  
2  
3  
4 
Since range is  2^{15} to 2^{15}  1
Y = 2^{16}  1
Here, +0 and 0 are represented separately.
X  Y = 2^{16}  (2^{16}  1)
= 1
Question 20 
A processor has 40 distinct instructions and 24 general purpose registers. A 32bit instruction word has an opcode, two register operands and an immediate operand. The number of bits available for the immediate operand ﬁeld is __________.
16 bits  
17 bits  
18 bits  
19 bits 
5 bits are needed for 24 general purpose registers (because, 2^{4} < 24 < 2^{5})
32bit instruction word has an opcode (6 bit), two register operands (total 10 bits) and an immediate operand (x bits).
The number of bits available for the immediate operand field
⇒ x = 32 – (6 + 10) = 16 bits
Question 21 
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex t at a distance four from the root. If t is the nth vertex in this BFS traversal, then the maximum possible value of n is _________.
31  
32  
33  
34 
For distance 1, max possible value is (3).
Similarly, for distance 2, max value is (7).
So, maximum number of nodes = 2^{(h+1)}  1
For distance 4, 2^{(4+1)}  1 ⇒ 2^{5}  1 ⇒ 32  1 = 31
31 is the last node.
So for distance 4, the maximum possible node will be 31 & minimum will be 16.
Question 22 
The value printed by the following program is __________.
void f(int* p, int m) { m = m + 5; *p = *p + m; return; } void main() { int i=5, j=10; f(&i, j); printf("%d", i+j); }
30  
31  
32  
33 
P is a pointer stores the address of i, & m is the formal parameter of j.
Now, m = m + 5;
*p = *p + m;
Hence, i + j will be 20 + 10 = 30.
Question 23 
Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE?

I. Quicksort runs in Θ(n^{2}) time
II. Bubblesort runs in Θ(n^{2}) time
III. Mergesort runs in Θ(n) time
IV. Insertion sort runs in Θ(n) time
I and II only  
I and III only  
II and IV only  
I and IV only 
→ The recurrence relation for Quicksort, if elements are already sorted,
T(n) = T(n1)+O(n) with the help of substitution method it will take O(n^{2}).
→ The recurrence relation for Merge sort, is elements are already sorted,
T(n) = 2T(n/2) + O(n) with the help of substitution method it will take O(nlogn).
We can also use master's theorem [a=2, b=2, k=1, p=0] for above recurrence.
Question 24 
The FloydWarshall algorithm for allpair shortest paths computation is based on
Greedy paradigm.  
DivideandConquer paradigm.  
Dynamic Programming paradigm.  
Neither Greedy nor DivideandConquer nor Dynamic Programming paradigm. 
It takes worst case time complexity is O(V^{3}) and worst case space complexity is O(V^{2}).
→ The Floyd–Warshall algorithm is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles).
→ A single execution of the algorithm will find the lengths (summed weights) of the shortest paths between all pairs of vertices.
Although it does not return details of the paths themselves, it is possible to reconstruct the paths with simple modifications to the algorithm.
Question 25 
N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decreasekey operation, a pointer is provided to the record on which the operation is to be performed.
An algorithm performs the following operations on the list in this order: Θ(N) delete,O(logN) insert, O(logN) ﬁnd, and Θ(N) decreasekey. What is the time complexity of all these operations put together?
O(log^{2} N)  
O(N)  
O(N^{2})  
Θ(N^{2} logN) 
→ Delete needs O(1) time
→ Insert takes O(N) time
→ Find takes O(N) time
→ Decrease by takes O(N) time
Now number of each operation performed is given, so finally total complexity,
→ Delete = O(1) × O(N) = O(N)
→ Find = O(N) × O(log N) = O(N log N)
→ Insert = O(N) × O(log N) = O(N log N)
→ Decrease key = O(N) × O(N) = O(N^{2})
So, overall time complexity is, O(N^{2}).
Question 26 
The number of states in the minimum sized DFA that accepts the language deﬁned by the regular expression
2  
3  
4  
5 
So, the DFA has two states.
Question 27 
Language L_{1} is deﬁned by the grammar: S_{1} → aS_{1}bε
Language L_{2} is deﬁned by the grammar: S_{2} → abS_{2}ε
Consider the following statements:

P: L_{1} is regular
Q: L_{2} is regular
Which one of the following is TRUE?
Both P and Q are true  
P is true and Q is false  
P is false and Q is true  
Both P and Q are false

So, in order to compare equality between a’s and b’s memory (stack) is required.
Hence, L_{1} is not regular.
Moreover, L_{1} = {a^{n} b^{n}  n ≥ 0} which is DCFL.
The language L_{2} generated by grammar contains repetition of “ab” i.e. L_{2} = (ab)* which is clearly a regular language.
Question 28 
Consider the following types of languages: L_{1}: Regular, L_{2}: Contextfree, L_{3} : Recursive, L_{4} : Recursively enumerable. Which of the following is/are TRUE?
I only  
I and III only  
I and IV only  
I, II and III only 
L_{3} is recursive, so is also recursive (because recursive language closed under complementation), so is recursive enumerable.
L_{4} is recursive enumerable.
So is also recursive enumerable (closed under union).
II.
L_{2} is context free, so L_{2} is recursive.
Since L_{2} is recursive. So is recursive.
L_{3} is recursive.
So is also recursive (closed under union)
III.
L_{1} is regular, so L_{1}* is also regular.
L_{2} is context free.
So, L_{1}*∩L_{2} is also context free (closed under regular intersection).
IV.
L_{1} is regular.
L_{2} is context free, so may or may not be context free (not closed under complement).
So, may or may not be context free.
Hence, answer is (D).
Question 29 
Match the following:
(P) Lexical analysis (i) Leftmost derivation (Q) Top down parsing (ii) Type checking (R) Semantic analysis (iii) Regular expressions (S) Runtime environments (iv) Activation records
P ↔ i, Q ↔ ii, R ↔ iv, S ↔ iii  
P ↔ iii, Q ↔ i, R ↔ ii, S ↔ iv  
P ↔ ii, Q ↔ iii, R ↔ i, S ↔ iv  
P ↔ iv, Q ↔ i, R ↔ ii, S ↔ iii 
Top down parsing has left most derivation of any string.
Type checking is done in semantic analysis.
Activation records are loaded into memory at runtime.
Question 30 
In which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?
LRU (Least Recently Used)  
OPT (Optimal Page Replacement)  
MRU (Most Recently Used)  
FIFO (First In First Out) 
In Belady’s anomaly is the phenomenon in which increasing the number of page frames results in an increase in the number of page faults for certain memory access patterns proves that it is possible to have more page faults when increasing the number of page frames while using the First in First Out (FIFO) page replacement algorithm.
In some situations, FIFO page replacement gives more page faults when increasing the number of page frames.
Question 31 
B^{+} Trees are considered BALANCED because
the lengths of the paths from the root to all leaf nodes are all equal.  
the lengths of the paths from the root to all leaf nodes differ from each other by at most 1.  
the number of children of any two nonleaf sibling nodes differ by at most 1.  
the number of records in any two leaf nodes differ by at most 1. 
Question 32 
Suppose a database schedule S involves transactions T_{1}, ..., T_{n}. Construct the precedence graph of S with vertices representing the transactions and edges representing the conﬂicts. If S is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule?
Topological order  
Depthﬁrst order  
Breadthﬁrst order  
Ascending order of transaction indices 
But BFS and DFS are also potssible for cyclic graphs.
And topological sort is not possible for cyclic graph.
Moreover option (D) is also wrong because in a transaction with more indices might come before lower one.
Question 33 
Anarkali digitally signs a message and sends it to Salim. Veriﬁcation of the signature by Salim requires
Anarkali’s public key.  
Salim’s public key.  
Salim’s private key.  
Anarkali’s private key. 
Receiver uses sender's public key to verify signature.
Question 34 
In an Ethernet local area network, which one of the following statements is TRUE?
A station stops to sense the channel once it starts transmitting a frame.  
The purpose of the jamming signal is to pad the frames that are smaller than the minimum frame size.  
A station continues to transmit the packet even after the collision is detected.  
The exponential backoff mechanism reduces the probability of collision on retransmissions. 
It is a protocol of data link layer and it tells how the data can be formatted to transmit and how to place the data on network for transmission.
Now considering the Ethernet protocol we will discuss all the options one by one
I. In Ethernet the station does not required, stops to sense the channel prior frame transmission.
II. A Jamming signal used to inform all the other devices or stations about collision that has occurred, so that further data transmission is stopped.
III. No, stations sends jamming signal if collusion is detected
IV. To reduce the probability of collision on retransmissions an exponential back off mechanism is used.
This is only True.
Question 35 
Identify the correct sequence in which the following packets are transmitted on the network by a host when a browser requests a webpage from a remote server, assuming that the host has just been restarted.
HTTP GET request, DNS query, TCP SYN  
DNS query, HTTP GET request, TCP SYN  
DNS query, TCP SYN, HTTP GET request  
TCP SYN, DNS query, HTTP GET request 
Question 36 
A binary relation R on ℕ × ℕ is deﬁned as follows: (a,b)R(c,d) if a≤c or b≤d. Consider the following propositions:

P: R is reﬂexive
Q: Ris transitive
Which one of the following statements is TRUE?
Both P and Q are true.  
P is true and Q is false.  
P is false and Q is true.  
Both P and Q are false. 
a≤c ∨ b≤d
Let a≤a ∨ b≤b is true for all a,b ∈ N
So there exists (a,a) ∀ a∈N.
It is Reflexive relation.
Consider an example
c = (a,b)R(c,d) and (c,d)R(e,f) then (a,b)R(e,f)
This does not hold for any (a>e) or (b>f)
eg:
(2,2)R(1,2) as 2≤2
(1,2)R(1,1) as 1≤1
but (2,2) R (1,1) is False
So, Not transitive.
Question 37 
Which one of the following wellformed formulae in predicate calculus is NOT valid?
(∀x p(x) ⇒ ∀x q(x)) ⇒ (∃x ¬p(x) ∨ ∀x q(x))  
(∃x p(x) ∨ ∃x q(x)) ⇒ ∃x (p(x) ∨ q(x))  
∃x (p(x) ∧ q(x)) ⇒ (∃x p(x) ∧ ∃x q(x))  
∀x (p(x) ∨ q(x)) ⇒ (∀x p(x) ∨ ∀x q(x)) 
Theorem:
a. ∀x [P(x) ∧ Q(x)] ≡ (∀x P(x) ∧ ∀x Q(x))
b. ∀x [P(x) ∨ Q(x)] is not ≡ (∀x P(x) ∨ ∀x Q(x))
c. ∃x [P(x) ∧ Q(x)] is not ≡ (∃x P(x) ∧ ∃x Q(x))
d. ∃x [P(x) ∨ Q(x)] ≡ (∃x P(x) ∨ ∃x Q(x))
Based on this, option C, D are not equivalent.
So, we get True => False conditions in options C, D which makes those Wellformed formulae invalid.
Question 38 
Consider a set U of 23 different compounds in a Chemistry lab. There is a subset S of U of 9 compounds, each of which reacts with exactly 3 compounds of U. Consider the following statements:

I. Each compound in U\S reacts with an odd number of compounds.
II. At least one compound in U\S reacts with an odd number of compounds.
III. Each compound in U\S reacts with an even number of compounds.
Which one of the above statements is ALWAYS TRUE?
Only I  
Only II  
Only III  
None 
U = 23
∃S ∋ (S⊂U)
Each component in ‘S’ reacts with exactly ‘3’ compounds of U,
If a component ‘a’ reacts with ‘b’, then it is obvious that ‘b’ also reacts with ‘a’.
It’s a kind of symmetric relation.>br> If we connect the react able compounds, it will be an undirected graph.
The sum of degree of vertices = 9 × 3 = 27
But, in the graph of ‘23’ vertices the sum of degree of vertices should be even because
(d_{i} = degree of vertex i.e., = no. of edges)
But ‘27’ is not an even number.
To make it an even, one odd number should be added.
So, there exists atleast one compound in U/S reacts with an odd number of compounds.
Question 39 
The value of the expression 13^{99}(mod 17), in the range 0 to 16, is ________.
4  
5  
6  
7 
a^{(p1)} ≡ 1 mod p (p is prime)
From given question,
p = 17
a^{(171)} ≡ 1 mod 17
a^{16} ≡ 1 mod 17
13^{16} ≡ 1 mod 17
Given:
13^{99} mod 17
13^{3} mod 17
2197 mod 17
4
Question 40 
Suppose the functions F and G can be computed in 5 and 3 nanoseconds by functional units U_{F} and U_{G}, respectively. Given two instances of U_{F} and two instances of U_{G}, it is required to implement the computation F(G(X_{i})) for 1 ≤ i ≤ 10. Ignoring all other delays, the minimum time required to complete this computation is _________ nanoseconds.
28  
29  
30  
31 
Since we have 2 instances of U_{F} and U_{G}, each unit need to be run 5 times to complete the execution.
Suppose computation starts at time 0, which means G starts at 0 and F starts at 3^{rd} second since F is dependent on G and G finishes computing first element at 3^{rd} second.
Computation of F ten times using two U_{F} units can be done in 5*10/2 = 25ns.
For the start U_{F} needs to wait for U_{G} output for 3ns and rest all are pipelined and hence no more wait.
So, answer is 3 + 25 = 28ns
We can see the timing diagram below:
Question 41 
Consider a processor with 64 registers and an instruction set of size twelve. Each instruction has ﬁve distinct ﬁelds, namely, opcode, two source register identiﬁers, one destination register r identiﬁer, and a twelvebit immediate value. Each instruction must be stored in memory in a bytealigned fashion. If a program has 100 instructions, the amount of memory (in bytes) consumed by the program text is _________.
500 bytes  
501 bytes  
502 bytes  
503 bytes 
(i) The opcode As we have instruction set of size 12, an instruction opcode can be identified by 4 bits, as 2^{4} = 16 and we cannot go any less.
(ii) & (iii) Two source register identifiers As there are total 64 registers, they can be identified by 6 bits. As they are two i.e. 6 bit + 6 bit.
iv) One destination register identifier Again it will be 6 bits.
v) A twelve bit immediate value 12 bit.
Adding them all we get,
4 + 6 + 6 + 6 + 12 = 34 bit = 34/8 byte = 4.25 bytes.
Due to byte alignment total bytes per instruction = 5 bytes.
As there are 100 instructions, total size = 5*100 = 500 Bytes.
Question 42 
The width of the physical address on a machine is 40 bits. The width of the tag ﬁeld in a 512 KB 8way set associative cache is _________ bits.
24  
25  
26  
27 
(Tag bits + bits for set no. + Bits for block offset)
In question block size has not been given, so we can assume block size 2^{x} Bytes.
The cache is of size 512KB, so number of blocks in the cache = 2^{19}/2^{x} = 2^{19x}
It is 8way set associative cache so there will be 8 blocks in each set.
So number of sets = (2^{19} − x)/8 = 2^{16} − x
So number of bits for sets = 16−x
Let number of bits for Tag = T
Since we assumed block size is 2^{x} Bytes, number of bits for block offset is x.
So, T + (16−x) + x = 40
T + 16 = 40
T = 24
Question 43 
Consider a 3 GHz (gigahertz) processor with a threestage pipeline and stage latencies τ_{1}, τ_{2}, τ_{3} and such that τ_{1 } = 3τ_{2}/4 = 2τ_{3}. If the longest pipeline stage is split into two pipeline stages of equal latency, the new frequency is _________ GHz, ignoring delays in the pipeline registers.
4  
5  
6  
7 
Given ,τ_{1} = 3 τ_{2}/4 = 2 τ_{3}
Put τ_{1} = 6t, we get τ_{2} = 8t, τ_{3} = 3t
Now largest stage time is 8t.
So, frequency is 1/8t
⇒ 1/8t = 3 GHz
⇒ 1/t = 24 GHz
From the given 3 stages, τ_{ 1} = 6t, τ_{ 2} = 8t and τ_{ 3} = 3t
So, τ_{ 2} > τ_{1} > τ_{3}.
The longest stage is τ_{2} = 8t and we will split that into two stages of 4t & 4t.
New processor has 4 stages  6t, 4t, 4t, 3t.
Now largest stage time is 6t.
So, new frequency is = 1/6t
We can substitute 24 in place of 1/t, which gives the new frequency as 24/6 = 4 GHz
Question 44 
A complete binary minheap is made by including each integer in [1, 1023] exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear is _________.
8  
9  
10  
11 
This is not possible because it violates a property of complete binary tree.
We have total [0, 1023] elements. It means that
∴ 2^{0} + 2^{1} + 2^{2} + ⋯ + 2^{k} = 1024
Add if 1(2^{(k+1)}1)/(21) [using formula for sum of k terms k+1 in G.P]
= 2^{(k+1)}  1 = 1024  1 = 1023
∴ The level ‘9’ at the depth of 8.
Actually we have 1023 elements, we can achieve a complete binary min heap of depth 9, which would cover all 1023 elements, but the max depth of node 9 can be only be 8.
Question 45 
The following function computes X^{Y} for positive integers X and Y.
int exp (int X, int Y) { int res = 1, a = X, b = Y; while ( b != 0 ){ if ( b%2 == 0) { a = a*a; b = b/2; } else { res = res*a; b = b1; } } return res; }
Which one of the following conditions is TRUE before every iteration of the loop?
X^{Y} = a^{b}  
(res * a)^{Y} = (res * X)^{b}  
X^{Y} = res * a^{b}  
X^{Y} = (res * a)^{b} 
{
int res = 1, a = X, b = Y;
while (b != 0)
{
if (b%2 == 0)
{
a = a*a;
b = b/2;
}
else
{
res = res*a;
b = b – 1;
}
}
return res;
}
From that explanation part you can understand the exponent operation, but to check the conditions, first while iteration is enough.
x = 2, y = 3, res = 2, a = 2, b = 2.
Only (C) satisfies these values.
x^{y} = res * a^{b}
2^{3} = 2 * 2^{2} = 8
Explanation:
Will compute for smaller values.
Let X = 2, Y = 3, res = 1
while (3 != 0)
{
if(3%2 == 0)  False
else
{
res = 1*2 = 2;
b = 3 – 1 = 2;
}
For options elimination, consider
return res = 2 (but it is out of while loop so repeat while)
__________
while (2 != 0)
{
if (2%2 == 0)  True
{
a = 2*2 = 4
b = 2/2 = 1
}
__________
repeat while
while (1 != 0)
{
if (1%2 == 0)  False
else
{
res = 2 * 4 = 8
b = 1 – 1 = 0
}
__________
while (0 != 0)  False
return res = 8 (2^{3})
Question 46 
Consider the following Neworder strategy for traversing a binary tree:
 Visit the root;
 Visit the right subtree using Neworder;
 Visit the left subtree using Neworder;
The Neworder traversal of the expression tree corresponding to the reverse polish expression 3 4 * 5  2 ˆ 6 7 * 1 +  is given by:
+  1 6 7 * 2 ˆ 5  3 4 *  
 + 1 * 6 7 ˆ 2  5 * 3 4  
 + 1 * 7 6 ˆ 2  5 * 4 3  
1 7 6 * + 2 5 4 3 *  ˆ  
Given Reverse Polish Notation as:
3 4 * 5  2 ^ 6 7 * 1 + 
We know Reverse Polish Notation takes Left, Right, Root.
So the expression tree looks like
From the tree, we can write the New Order traversal as: Root, Right, Left.
 + 1 * 7 6 ^ 2  5 * 4 3
Question 47 
Consider the following program:
int f(int *p, int n) { if (n <= 1) return 0; else return max (f(p+1,n1),p[0]p[1]); } int main() { int a[] = {3,5,2,6,4}; printf("%d", f(a,5)); }Note: max(x,y) returns the maximum of x and y.
The value printed by this program is __________.
3  
4  
5  
6 
f(a, 5) ⇒ f(100, 5)
Question 48 
Let A_{1}, A_{2}, A_{3} and A_{4} be four matrices of dimensions 10 × 5, 5 × 20, 20 × 10, and 10 × 5, respectively. The minimum number of scalar multiplications required to ﬁnd the product A_{1}A_{2}A_{3}A_{4} using the basic matrix multiplication method is _________.
1500  
1501  
1502  
1503 
The optimal parenthesized sequence is A_{1}((A_{2}A_{3})A_{4}) out of many possibilities, the possibilities are
1. ((A_{1}A_{2})A_{3})A_{4}
2. ((A_{1}(A_{2}A_{3}))A_{4})
3. (A_{1}A_{2})(A_{3}A_{4})
4. A_{1}((A_{2}A_{3})A_{4})
5. A_{1}(A_{2}(A_{3}A_{4}))
→ A_{1}((A_{2}A_{3})A_{4}) = (5 x 20 x 10) + (5 x 10 x 5) + (10 x 5 x 5) = 1000 + 250 + 250 = 1500
Question 49 
The given diagram shows the ﬂowchart for a recursive function A(n). Assume that all statements, except for the recursive calls, have O(1) time complexity. If the worst case time complexity of this function is O(n^{α}), then the least possible value (accurate upto two decimal positions) of α is _________.
2.3219280  
2.3219281  
2.3219282  
2.3219283 
According to flow chart total 5 worst case possibilities of function calls.
The remaining function calls/return statements will execute only constant amount of time.
So, total function calls 5.
The Recurrence will be
A(n) = 5A(n/2) + O(1)
Apply Master’s theorem,
A=5, b=2, k=0, p=0
a > b^{k} case
A(n) = n^{(logba )} = n^{(log25)} = n^{2.3219280}
∴α = 2.3219280
Question 50 
The number of ways in which the numbers 1, 2, 3, 4, 5, 6, 7 can be inserted in an empty binary search tree, such that the resulting tree has height 6, is _________.
Note: The height of a tree with a single node is 0.64  
65  
66  
67 
Given the height of a tree with a single node is 0.
The root must be either 1 or 7, so with 1, 7 we can form 2 ways (left & right skew) each.
For each height we have 2 choices, except the leaf node.
Hence T(n) = 2 * T (n – 1)
∵ Total number of ways will be 2^{(n1)} = 2^{(71)} = 2^{6} = 64
Question 51 
In an adjacency list representation of an undirected simple graph G = (V,E), each edge (u,v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If E = m and V = n, and the memory size is not a constraint, what is the time complexity of the most efﬁcient algorithm to set the twin pointer in each entry in each adjacency list?
Θ(n^{2})  
Θ(n+m)  
Θ(m^{2})  
Θ(n^{4}) 
Visit every vertex levelwise for every vertex fill adjacent vertex in the adjacency list. BFS take O(m+n) time.
Note:
Twin Pointers can be setup by keeping track of parent node in BFS or DFS of graph.
Question 52 
Consider the following two statements:

I. If all states of an NFA are accepting states then the language accepted by the NFA is Σ*.
II. There exists a regular language A such that for all languages B, A∩B is regular.
Which one of the following isCORRECT?
Only I is true  
Only II is true  
Both I and II are true  
Both I and II are false 
The reason is NFA doesn’t have dead state, so even though all states are final state in NFA, the NFA will reject some strings.
For ex:
Consider L = a*b*
The NFA would be:
Even though all states are final states in above NFA, but it doesn’t accept string “aba”.
Hence its language can’t be ∑*.
Statement II is true:
Since A= Φ is a regular language and its intersection with any language B will be Φ (which is regular).
Question 53 
Consider the following languages:

L_{1} = {a^{n} b^{m} c^{n+m} : m,n ≥ 1}
L_{2} = {a^{n} b^{n} c^{2n} : n ≥ 1}
Which one of the following isTRUE?
Both L_{1} and L_{2} are contextfree.  
L_{1} is contextfree while L_{2} is not contextfree.  
L_{2} is contextfree while L_{1} is not contextfree.  
Neither L_{1} nor L_{2} is contextfree. 
At the end if input and stack is empty then accept.
Hence, it is CFL.
But L_{2} can’t be recognized by PDA, i.e. by using single stack.
The reason is, it has two comparison at a time,
1^{st} comparison:
number of a’s = number of b’s
2^{nd} comparison:
number of c’s must be two times number of a’s (or b’s)
It is CSL.
Question 54 
Consider the following languages.

L_{1} = {〈M〉M takes at least 2016 steps on some input},
L_{2} = {〈M〉│M takes at least 2016 steps on all inputs} and
L_{3} = {〈M〉M accepts ε},
where for each Turing machine M, 〈M〉 denotes a speciﬁc encoding of M. Which one of the following is TRUE?
L_{1} is recursive and L_{2}, L_{3} are not recursive  
L_{2} is recursive and L_{1}, L_{3} are not recursive  
L_{1}, L_{2} are recursive and L_{3} is not recursive  
L_{1}, L_{2}, L_{3} are recursive 
Since counting any number of steps can be always decided.
We can simulate TM (M) whether it takes more than 2016 steps on some input string, which has length upto 2016.
If it happens then reached to accepting (YES) state else reject (NO).
L_{2} is recursive:
Similarly, we can simulate TM (M) whether it takes more than 2016 steps on each input string which has length upto 2016.
If it happens then reached to accepting (YES) state else reject (NO).
L_{3} is not recursive:
If L_{3} is recursive then we must have a Turing machine for L_{3}, which accept epsilon and reject all strings and always HALT.
Since Halting of Turing machine can’t be guaranteed in all the case.
Hence this language is not recursive.
Question 55 
Which one of the following grammars is free from left recursion?
The grammar in option C has indirect left recursion because of production, (S→Aa and A→Sc).
The grammar in option D also has indirect left recursion because of production, (A→Bd and B→Ae).
Question 56 
A student wrote two contextfree grammars G1 and G2 for generating a single Clike array declaration. The dimension of the array is at least one. For example,

int a[10][3];
Grammar G1 Grammar G2 D → intL; D → intL; L → id[E L → idE E → num] E → E[num] E → num][E E → [num]Which of the grammars correctly generate the declaration mentioned above?
Both G1 and G2  
Only G1  
Only G2  
Neither G1 nor G2 
Question 57 
Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remainingtime ﬁrst.
The average turn around time of these processes is _________ milliseconds.
8.25  
8.26  
8.27  
8.28 
To answer the question we need to design the gantt chart:
In this algorithm, the processes will be scheduled on the CPU which will be having least remaining burst time.
Turnaround Time (TAT) = Completion Time (CT)  Arrival Time (AT)
TAT for P_{1} = 20  0 = 20,
TAT for P_{2} = 10  3 = 7,
TAT for P_{3} = 8  7 = 1,
TAT for P_{4} = 13  8 = 5.
Total TAT = 20 + 7 + 1 + 5 = 33 / 4 = 8.25 (Avg. TAT)
Question 58 
Consider the following twoprocess synchronization solution.
Process 0 Process 1   Entry: loop while (turn == 1); Entry: loop while (turn == 0); (critical section) (critical section) Exit: turn = 1; Exit: turn = 0;
The shared variable turn is initialized to zero. Which one of the following is TRUE?
This is a correct twoprocess synchronization solution.  
This solution violates mutual exclusion requirement.  
This solution violates progress requirement.  
This solution violates bounded wait requirement. 
So False.
C) Progress means if one process does not want to enter the critical section then it should not stop other process to enter the critical section.
But we can see that if process 0 will not enter the critical section then value of turn will not become 1 and process 1 will not be able to enter critical section.
So progress not satisfied. True.
D) Bounded waiting solution as there is a strict alteration.
So, False.
Question 59 
Consider a nonnegative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked is _________.
7  
8  
9  
10 
P(S) operation remain in blocked state therefore it will 1.
The negative value of the counting semaphore indicates the number of processes in suspended list (or blocked).
Take any sequence of 20P and 12V operations, at least one process will always remain blocked.
So, X  20 + 12 = 1
Here P(S) = 20 and V(S) = 12
X = 7
Question 60 
A ﬁle system uses an inmemory cache to cache disk blocks. The miss rate of the cache is shown in the ﬁgure. The latency to read a block from the cache is 1 ms and to read a block from the disk is 10 ms. Assume that the cost of checking whether a block exists in the cache is negligible. Available cache sizes are in multiples of 10 MB.
The smallest cache size required to ensure an average read latency of less than 6 ms is _______ MB.
30  
31  
32  
33 
So we consider it as hierarchical memory.
But it is given that “assume that the cost of checking whether a block exists in the cache is negligible”, which means don't consider the checking time in the cache when there is a miss.
So formula for average access time becomes h1t1 + (1h1)(t2) which is same as for simultaneous access.
Though the memory is hierarchical because of the statement given in the question we ignored the cache access time when there is a miss and effectively the calculation became like simultaneous access.
The average access time or read latency = h1t1 + (1h1)t2.
It is given that the average read latency has to be less than 6ms.
So, h1t1 + (1h1)t2 < 6
From the given information t1 = 1ms, t2 = 10ms
h1*1+(1h1)10 < 6
109h1 < 6
9h1 <  4
h1 <  4/9
h1 < 0.444
Since in the given graph we have miss rate information and 1h1 gives the miss rate, so we add 1 on both sides of the above inequality.
1h1 < 10.444
1h1 < 0.555
So for the average read latency to be less than 6 ms the miss rate hsa to be less than 55.5%.
From the given graph the closest value of miss rate less than 55.5 is 40%.
For 40% miss rate the corresponding cache size is 30MB.
Hence the answer is 30MB.
Question 61 
Consider the following database schedule with two transactions, T_{1} and T_{2}.

S = r_{2}(X); r_{1}(X); r_{2}(Y); w_{1}(X); r_{1}(Y); w_{2}(X); a_{1}; a_{2}
where r_{i}(Z) denotes a read operation by transaction T_{i} on a variable Z, w_{i}(Z) denotes a write operation by T_{i} on a variable Z and a_{i} denotes an abort by transaction T_{i}.
Which one of the following statements about the above schedule is TRUE?
S is nonrecoverable  
S is recoverable, but has a cascading abort  
S does not have a cascading abort  
S does not have a cascading abort 
• Option (A) is not possible, because there is no dirty read. So, it is Recoverable.
• Option (B) is not possible, because of there is no dirty read . So, no cascading aborts.
• Option (D): Not possible, because T_{2} can only Read or Write the same variable written by T_{1} after T_{1} has aborted or commited.
But here T_{2} has written (X) before T_{1} has aborted. So the schedule is not strict schedule.
• So, C is the correct option.
Question 62 
Consider the following database table named water_schemes :
The number of tuples returned by the following SQL query is _________.
with total(name, capacity) as select district_name, sum(capacity) from water_schemes group by district_name with total_avg(capacity) as select avg(capacity) from total select name from total, total_avg where total.capacity ≥ total_avg.capacity
2  
3  
4  
5 
The name assigned to the subquery is treated as though it was an inline view or table.
• First group by district name is performed and total capacities are obtained as following:
• Then average capacity is computed, Average Capacity = (20 + 40 + 30 + 10)/4 = 100/4 = 25
• Finally, 3rd query will be executed and it's tuples will be considered as output, where name of district and its total capacity should be more than or equal to 25.
• Then average capacity is computed,
Average Capacity = (20 + 40 + 30 + 10)/4 = 100/4 = 25
• Finally, 3^{rd} query will be executed and it's tuples will be considered as output, where name of district and its total capacity should be more than or equal to 25.
Question 63 
A network has a data transmission bandwidth of 20 × 10^{6} bits per second. It uses CSMA/CD in the MAC layer. The maximum signal propagation time from one node to another node is 40 microseconds. The minimum size of a frame in the network is _________ bytes.
200  
201  
202  
203 
Given,
Bandwidth (B) = 20 × 10^{6} bps
T_{P} = 40 μs ⇒ 40 × 10^{ 6} sec
Suppose minimum frame size is L.
T_{t} = 2 × T_{P} ⇒ L / B = 2 × T_{P}
⇒ L = 2 × T_{P} × B = 2 × 40 × 10^{6} × 20 × 10^{6} = 1600 bits ⇒ 200 bytes
Therefore, L = 200 bytes
Question 64 
For the IEEE 802.11 MAC protocol for wireless communication, which of the following statements is/are TRUE?

I. At least three nonoverlapping channels are available for transmissions.
II. The RTSCTS mechanism is used for collision detection.
III. Unicast frames are ACKed.
All I, II, and III  
I and III only  
II and III only  
II only 
I. This is true, maximum 3 overlapping channels are possible in Wifi.
II. The RTS (Request To Send) and CTS(Clear To Send) are control frames which is used for collision avoidance, not in collision detection, (so, II is False)
III. Every frame in Wifi is Acked, because Wifi stations do not use collusion detection. (True)
Question 65 
Consider a 128 × 10^{3} bits/ second satellite communication link with one way propagation delay of 150 milliseconds. Selective retransmission (repeat) protocol is used on this link to send data with a frame size of 1 kilobyte. Neglect the transmission time of acknowledgement. The minimum number of bits required for the sequence number ﬁeld to achieve 100% utilization is __________.
4  
5  
6  
7 
a = T_{p} / T_{t} where T_{p} is propagation delay, and T_{t} is transmission delay.
Given, B = 128 kbps, T_{p} = 150 msec,
L = 1 KB = 1 * 8 * 2^{10} bits
T_{t} = L / B ⇒ 1 * 8 * 2^{10} bits / 128 * 10^{3} bps ⇒ 0.064 sec = 64 msec
So, a = 150 msec / 64 msec = 2.343
Efficiency (η) = 100 % ⇒ 1 = N/ 1 + 2 * a
So, N = 1 + 2 * a ⇒ 1 + 2 * 2.343 = 5.686
No. of sequence numbers requires in SR is 2*N = 2 *5.686 = 11.375
Minimum No. of bits required in the sequence number = [ log_{2} (11.375) ] = 4