GATE 2005IT
Question 1 
A bag contains 10 blue marbles, 20 green marbles and 30 red marbles. A marble is drawn from the bag, its colour recorded and it is put back in the bag. This process is repeated 3 times. The probability that no two of the marbles drawn have the same colour is
1/36  
1/6  
1/4  
1/3 
Total possible combinations = 3! = 6
Probability of blue marble = 10/60[10 + 20 + 30 = 60]
Probability of green marble = 20/60
Probability of red marble = 30/60
The probability that no two of the marbles has same colour = [10/60 * 20/60 * 30/60] = 1/6
Question 2 
If the trapezoidal method is used to evaluate the integral obtained _{0}∫^{1}x^{2}dx ,then the value obtained
is always > (1/3)  
is always < (1/3)  
is always = (1/3)  
may be greater or lesser than (1/3) 
Question 3 
The determinant of the matrix given below is
1  
0  
1  
2 
determinant = product of diagonal element [upper triangular matrix]
= 1 * 1 * 1 * 1
= 1
Question 4 
Let L be a regular language and M be a contextfree language, both over the alphabet Σ. Let L^{c} and M^{c} denote the complements of L and M respectively. Which of the following statements about the language if L^{c} ∪ M^{c} is TRUE?
It is necessarily regular but not necessarily contextfree.  
It is necessarily contextfree.  
It is necessarily nonregular.  
None of the above. 
Question 5 
Which of the following statements is TRUE about the regular expression 01*0?
It represents a finite set of finite strings.  
It represents an infinite set of finite strings.  
It represents a finite set of infinite strings.  
It represents an infinite set of infinite strings. 
So, given regular expression represents an infinite set of finite strings.
Question 6 
The language {0^{n} 1^{n} 2^{n}  1 ≤ n ≤ 10^{6}} is
regular  
contextfree but not regular  
contextfree but its complement is not contextfree  
not contextfree 
So, given language is regular.
Question 7 
Which of the following expressions is equivalent to (A⊕B)⊕C
None of these 
⇒ We know that
A⊕B = A'B + AB'
A⊙B = AB + A'B' ⇒ (A⊕B)'C + (A⊕B)C'
⇒ (A⊙B)C + (A'B + AB')C'
⇒ (AB + A'B')C + (A'B + AB')C'
⇒ ABC + A'B'C + A'BC' + AB'C'
⇒ ABC + (A'B'C + A'B'C) + A'BC' + AB'C'
[We know that A + A = A]
⇒ ABC + A'B'C + A'B'C + A'BC' + AB'C'
⇒ ABC + A'(B'C + BC') + B'(A'C + AC')
⇒ ABC + A'(B⊕C) + B'(A⊕C)
Question 8 
Using Booth’s Algorithm for multiplication, the multiplier 57 will be recoded as
0 1 0 0 1 0 0 1  
1 1 0 0 0 1 1 1  
0 1 0 0 1 0 0 0  
0 1 0 0 1 0 0 1 
Question 9 
A dynamic RAM has a memory cycle time of 64 nsec. It has to be refreshed 100 times per msec and each refresh takes 100 nsec. What percentage of the memory cycle time is used for refreshing?
10  
6.4  
1  
.64 
In 10^{6}ns refresh 100 times.
Each refresh takes 100ns.
Memory cycle time = 64ns
Refresh time per 1ms i.e., per 10^{6}ns = 100 * 100 = 10^{4}ns
Refresh time per 1ns = (10^{4})/(10^{6}) ns
Refresh time per cycle = (10^{4}*64)/(10^{6}) = 64ns
Percentage of the memory cycle time is used for refreshing = (64*100)/64 = 1%
Question 10 
A twoway switch has three terminals a, b and c. In ON position (logic value 1), a is connected to b, and in OFF position, a is connected to c. Two of these twoway switches S1 and S2 are connected to a bulb as shown below.
Which of the following expressions, if true, will always result in the lighting of the bulb ?
From this we can clearly know that given is EXNOR operation i.e.,
(S1⊙S2) = (S1⊕S2)'
Question 11 
How many pulses are needed to change the contents of a 8bit up counter from 10101100 to 00100111 (rightmost bit is the LSB)?
134  
133  
124  
123 
→ First counter is move from 172 to 255 = 83 pulses
→ 255 to 0 = 1 pulse
→ 0 to 39 = 39 pulses
Total = 83 + 1 + 39 = 123 pulses
Question 12 
The numbers 1, 2, .... n are inserted in a binary search tree in some order. In the resulting tree, the right subtree of the root contains p nodes. The first number to be inserted in the tree must be
p  
p + 1  
n  p  
n  p + 1 
RST contains elements = p
Root contains = 1 element
1^{st} contains = n  (p + 1) element
Root contains the value is n  p.
Question 13 
A function f defined on stacks of integers satisfies the following properties.
f(∅) = 0 and f (push (S, i)) = max (f(S), 0) + i for all stacks S and integers i.
If a stack S contains the integers 2, 3, 2, 1, 2 in order from bottom to top, what is f(S)?
6  
4  
3  
2 
f(Ø)=0 and f(push(S,i) = max(f(S),0) + i;
Initially stack is empty and for empty stack 0 is given.
f(push(0,2)) = max(f(Ø),0) + 2 = max(Ø,0) + 2 = 2
f(push(2,3)) = max(2,0) + (3) = 2  3 = 1
f(push(1,2)) = max(1,0) + 2 = 0 + 2 = 2
f(push(2,1)) = max(2,0)+ (1) = 2  1 = 1
f(push(1,2)) = max(1,0) + 2 = 1 + 2 = 3
So, 3 will be the answer.
∴ Option C is correct.
Question 14 
In a depthfirst traversal of a graph G with n vertices, k edges are marked as tree edges. The number of connected components in G is
k  
k + 1  
n  k  1  
n  k 
In this question, we are going to applying the depth first search traversal on each component of graph where G is connected (or) disconnected which gives minimum spanning tree
i.e., k = np
p = n  k
Question 15 
In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Match each algorithm with its time complexity.
1. BellmanFord algorithm A: O ( m log n) 2. Kruskal’s algorithm B: O (n^{3}) 3. FloydWarshall algorithm C: O (nm) 4. Topological sorting D: O (n + m)
1→ C, 2 → A, 3 → B, 4 → D  
1→ B, 2 → D, 3 → C, 4 → A  
1→ C, 2 → D, 3 → A, 4 → B  
1→ B, 2 → A, 3 → C, 4 → D 
Krushkal's algorithm → O(m log n)
FloydWarshall algorithm → O(n^{3})
Topological sorting → O(n+m)
Question 16 
A hash table contains 10 buckets and uses linear probing to resolve collisions. The key values are integers and the hash function used is key % 10. If the values 43, 165, 62, 123, 142 are inserted in the table, in what location would the key value 142 be inserted?
2  
3  
4  
6 
165%10 = 5 [occupy 5]
62%10 = 2 [occupy 2]
123%10 = 3 [3 already occupied, so occupies 4]
142%10 = 2 [2, 3, 4, 5 are occupied, so it occupies 6]
Question 17 
A student wishes to create symbolic links in a computer system running Unix. Three text files named "file 1", "file 2" and "file 3" exist in her current working directory, and the student has read and write permissions for all three files. Assume that file 1 contains information about her hobbies, file 2 contains information about her friends and file 3 contains information about her courses. The student executes the following sequence of commands from her current working directory
ln s file 1 file 2 ln s file 2 file 3
Which of the following types of information would be lost from her file system?
(I) Hobbies (II) Friends (III) Courses
(I) and (II) only  
(II) and (III) only  
(II) only  
(I) and (III) only 
Question 18 
The shell command
find name passwd print
is executed in /etc directory of a computer system running Unix. Which of the following shell commands will give the same information as the above command when executed in the same directory?
ls passwd  
cat passwd  
grep name passwd  
grep print passwd 
Question 19 
A user level process in Unix traps the signal sent on a CtrlC input, and has a signal handling routine that saves appropriate files before terminating the process. When a CtrlC input is given to this process, what is the mode in which the signal handling routine executes?
kernel mode  
superuser mode  
privileged mode  
user mode 
Question 20 
The Function Point (FP) calculated for a software project are often used to obtain an estimate of Lines of Code (LOC) required for that project. Which of the following statements is FALSE in this context.
The relationship between FP and LOC depends on the programming language used to implement the software.  
LOC requirement for an assembly language implementation will be more for a given FP value, than LOC for implementation in COBOL  
On an average, one LOC of C++ provides approximately 1.6 times the functionality of a single LOC of FORTRAN  
FP and LOC are not related to each other 
Question 21 
Consider the entities 'hotel room', and 'person' with a many to many relationship 'lodging' as shown below:
If we wish to store information about the rent payment to be made by person (s) occupying different hotel rooms, then this information should appear as an attribute of
Person  
Hotel Room  
Lodging  
None of theseThe information should appear as an attribute of lodging, because this is the only common attribute that relating to the hotel room and person. The information should appear as an attribute of lodging, because this is the only common attribute that relating to the hotel room and person. 
Question 22 
A table has fields Fl, F2, F3, F4, F5 with the following functional dependencies
F1 → F3, F2→ F4, (F1.F2) → F5
In terms of Normalization, this table is in
1 NF  
2 NF  
3 NF  
None 
F2 → F4 ......(ii)
(F1⋅F2) → F5 .....(iii)
F1F2 is the candidate key.
F1 and F2 are the prime key.
In (i) and (ii) we can observe that the relation from P → NP which is partial dependency. So this is in 1NF.
Question 23 
A BTree used as an index for a large database table has four levels including the root node. If a new key is inserted in this index, then the maximum number of nodes that could be newly created in the process are:
5  
4  
3  
2 
Here, the tree has 4 levels, then 4+1=5 nodes to be present in the newly created process.
Question 24 
Amongst the ACID properties of a transaction, the 'Durability' property requires that the changes made to the database by a successful transaction persist
Except in case of an Operating System crash  
Except in case of a Disk crash  
Except in case of a power failure  
Always, even if there is a failure of any kind 
Question 25 
Consider the three commands : PROMPT, HEAD and RCPT.
Which of the following options indicate a correct association of these commands with protocols where these are used?
HTTP, SMTP, FTP  
FTP, HTTP, SMTP  
HTTP, FTP, SMTP  
SMTP, HTTP, FTP 
Question 26 
Traceroute reports a possible route that is taken by packets moving from some host A to some other host B. Which of the following options represents the technique used by traceroute to identify these hosts
By progressively querying routers about the next router on the path to B using ICMP packets, starting with the first router  
By requiring each router to append the address to the ICMP packet as it is forwarded to B. The list of all routers enroute to B is returned by B in an ICMP reply packet  
By ensuring that an ICMP reply packet is returned to A by each router enroute to B, in the ascending order of their hop distance from A  
By locally computing the shortest path from A to B 
So the first router forwards the packets, but the second router drops them and replies with ICMP time exceeded. Proceeding in this way, traceroute uses the returned ICMP time exceeded messages to build a list of routers that packets traverse, until the destination is reached and returns an ICMP echo reply message.
Question 27 
Which of the following statements is TRUE about CSMA/CD
IEEE 802.11 wireless LAN runs CSMA/CD protocol  
Ethernet is not based on CSMA/CD protocol  
CSMA/CD is not suitable for a high propagation delay network like satellite network  
There is no contention in a CSMA/CD network 
For networks with high propagation delay this time becomes too long hence the minimum packet size required becomes too big to be feasible.
Question 28 
Which of the following statements is FALSE regarding a bridge?
Bridge is a layer 2 device  
Bridge reduces collision domain  
Bridge is used to connect two or more LAN segments  
Bridge reduces broadcast domain 
The bridge acts as a interface between two networks and speed the traffic between them and there by reduces the collision domain.
So, option B also True.
Question 29 
Count to infinity is a problem associated with
link state routing protocol.  
distance vector routing protocol.  
DNS while resolving host name.  
TCP for congestion control. 
The BellmanFord algorithm does not prevent routing loops from happening and suffers from the counttoinfinity problem.
Question 30 
A HTML form is to be designed to enable purchase of office stationery. Required items are to be selected (checked). Credit card details are to be entered and then the submit button is to be pressed. Which one of the following options would be appropriate for sending the data to the server. Assume that security is handled in a way that is transparent to the form design.
Only GET  
Only POST  
Either of GET or POST  
Neither GET nor POST 
Question 31 
Let f be a function from a set A to a set B, g a function from B to C, and h a function from A to C, such that h(a) = g(f(a)) for all a ∈ A. Which of the following statements is always true for all such functions f and g?
g is onto ⇒ h is onto  
h is onto ⇒ f is onto  
h is onto ⇒ g is onto  
h is onto ⇒ f and g are onto 
If h: A→C is a onto function, the composition must be onto, but the first function in the composition need to be onto.
So, B→C is must be onto.
Question 32 
Let A be a set with n elements. Let C be a collection of distinct subsets of A such that for any two subsets S_{1} and S_{2} in C, either S_{1 }⊂ S_{2} or S_{2 }⊂ S_{1}. What is the maximum cardinality of C?
n  
n + 1  
2^{(n1)} + 1  
n! 
Let A = {a, b, c}, here n = 3
Now, P(A) = {Ø, {a}, {b}, {c}, {a,b}, {b,c}, {{a}, {a,b,c}}
Now C will be contain Ø (empty set) and {a,b,c} (set itself) as Ø is the subset of every set. And every other subset is the subset of {a,b,c}.
Now taking the subset of cardinality, we an take any 1 of {a}, {b}, {c} as none of the set is subset of other.
Let's take {2}
→ Now taking the sets of cardinality 2 {a,b}, {b,c}
→ {b} ⊂ {a,b} and {b,c} but we can't take both as none of the 2 is subset of the other.
→ So let's take {c,a}.
So, C = {Ø, {b}, {b,c}, {a,b,c}}
→ So, if we observe carefully, we can see that we can select only 1 set from the subsets of each cardinality 1 to n
i.e., total n subsets + Ø = n + 1 subsets of A can be there in C.
→ So, even though we can have different combinations of subsets in C but maximum cardinality of C will be n+1 only.
Question 33 
An unbiased coin is tossed repeatedly until the outcome of two successive tosses is the same. Assuming that the trials are independent, the expected number of tosses is
3  
4  
5  
6 
The expected number of coin flips for getting n consecutive heads is(2^(n+1) 2)
The expected number of coin flips for getting n consecutive heads is(2^(n+1) 2)
The expected number of coin flips for getting n consecutive same tosses is (2^(n+1) 2) / 2.
where n = 2,
which is (2^(3+1)  2) / 2 = 3
Question 34 
Let n = p^{2}q, where p and q are distinct prime numbers. How many numbers m satisfy 1 ≤ m ≤ n and gcd (m, n) = 1? Note that gcd (m, n) is the greatest common divisor of m and n.
p(p  1)  
pq  
(p^{2}  1)(q  1)  
p(p  1)(q  1) 
→ No. of multiples of p in n = pq [n = p⋅p⋅q]
→ No. of multiples of q in n = p^{2} [n = p^{2}q]
→ Prime factorization of n contains only p & q.
→ gcd(m,n) is to be multiple of p and (or) 1.
→ So, no. of possible m such that gcd(m,n) is 1 will be
n  number of multiples of either p (or) q
= n  p^{2}  pq + p
= p^{2}q  p^{2}  pq + p
= p(pq  p  q + 1)
= p(p  1)(q  1)
Question 35 
What is the value of
1  
1  
0  
π 
In the limits are be π to π, one is odd and another is even product of even and odd is odd function and integrating function from the same negative value to positive value gives 0.
Question 36 
Let P(x) and Q(x) be arbitrary predicates. Which of the following statements is always TRUE?
((∀x(P(x)∨Q(x)))) ⟹ ((∀xP(x))∨(∀xQ(x)))  
(∀x(P(x) ⟹ Q(x))) ⟹ ((∀xP(x)) ⟹ (∀xQ(x)))  
(∀x(P(x)) ⟹ ∀x(Q(x))) ⟹ (∀x(P(x) ⟹ Q(x)))  
(∀x(P(x)) ⇔ (∀x(Q(x)))) ⟹ (∀x(P(x) ⇔ Q(x)))

RHS: (∀xP(x)) and (∀xQ(x)) both becomes False for assumed values which implies F→F and result will be True.
∴ LHS = RHS
Question 37 
Consider the nondeterministic finite automaton (NFA) shown in the figure.
State X is the starting state of the automaton. Let the language accepted by the NFA with Y as the only accepting state be L1. Similarly, let the language accepted by the NFA with Z as the only accepting state be L2. Which of the following statements about L1 and L2 is TRUE? Correction in Question: There is an edge from Z>Y labeled 0 and another edge from Y>Z labeled 1  in place of double arrowed and no arrowed edges.
L1 = L2  
L1 ⊂ L2  
L2 ⊂ L1  
None of the above 
Y = X0 + Y0 + Z1
Z = X0 + Y0 + Z;
⇒ X = Z;
⇒ L1 = L2
Question 38 
Let P be a nondeterministic pushdown automaton (NPDA) with exactly one state, q, and exactly one symbol, Z, in its stack alphabet. State q is both the starting as well as the accepting state of the PDA. The stack is initialized with one Z before the start of the operation of the PDA. Let the input alphabet of the PDA be Σ. Let L(P) be the language accepted by the PDA by reading a string and reaching its accepting state. Let N(P) be the language accepted by the PDA by reading a string and emptying its stack.
Which of the following statements is TRUE?
L(P) is necessarily Σ* but N(P) is not necessarily Σ*  
N(P) is necessarily Σ* but L(P) is not necessarily Σ*  
Both L(P) and N(P) are necessarily Σ*  
Neither L(P) nor N(P) are necessarily Σ*

Question 39 
Consider the regular grammar:
S → Xa  Ya
X → Za Z → Sa  ϵ
Y → Wa W → Sa
where S is the starting symbol, the set of terminals is {a} and the set of nonterminals is {S, W, X, Y, Z}. We wish to construct a deterministic finite automaton (DFA) to recognize the same language. What is the minimum number of states required for the DFA?
2  
3  
4  
5 
The minimum string length is 2 [aa], so we require 3 states to construct DFA.
Question 40 
A language L satisfies the Pumping Lemma for regular languages, and also the Pumping Lemma for contextfree languages. Which of the following statements about L is TRUE?
L is necessarily a regular language  
L is necessarily a contextfree language, but not necessarily a regular language  
L is necessarily a nonregular language  
None of the above 
Question 41 
Given below is a program which when executed spawns two concurrent processes:
semaphore X := 0 ; /* Process now forks into concurrent processes P1 & P2 */ P1: repeat forever P2: repeat forever V(X); P(X); Compute; Compute; P(X); V(X);
Consider the following statements about processes P1 and P2:
I. It is possible for process P1 to starve.
II. It is possible for process P2 to starve.
Which of the following holds?
Both 1 and 2 are true  
1 is true but 2 is false  
2 is true but 1 is false  
Both 1 and 2 are false 
P2 can be starves on P, then P1 loops forever.
Both statements (i) and (ii) are True.
Question 42 
Two concurrent processes P1 and P2 use four shared resources R1, R2, R3 and R4, as shown below.
P1: P2: Compute: Compute; Use R1; Use R1; Use R2; Use R2; Use R3; Use R3; Use R4; Use R4;
Both processes are started at the same time, and each resource can be accessed by only one process at a time The following scheduling constraints exist between the access of resources by the processes:
P2 must complete use of R1 before P1 gets access to R1.
P1 must complete use of R2 before P2 gets access to R2.
P2 must complete use of R3 before P1 gets access to R3.
P1 must complete use of R4 before P2 gets access to R4.
There are no other scheduling constraints between the processes. If only binary semaphores are used to enforce the above scheduling constraints, what is the minimum number of binary semaphores needed?
1  
2  
3  
4 
Question 43 
Which of the following input sequences will always generate a 1 at the output Z at the end of the third cycle?
000 101 111  
101 110 111  
011 101 111  
001 110 111  
None of these 
While filling done in reverse order, all operations are not satisfied.
Question 44 
We have two designs D1 and D2 for a synchronous pipeline processor. D1 has 5 pipeline stages with execution times of 3 nsec, 2 nsec, 4 nsec, 2 nsec and 3 nsec while the design D2 has 8 pipeline stages each with 2 nsec execution time How much time can be saved using design D2 over design D1 for executing 100 instructions?
214 nsec  
202 nsec  
86 nsec  
200 nsec 
n = no. of instructions
Total execution time = (k+n1) * maximum clock cycle
In case of D_{1}:
k = 5
n = 100
Maximum clock cycle = 4 ns
Total execution time = (5+1001) * 4 = 416
In case of D_{2}:
k = 8
n = 100
Maximum clock cycle = 2 ns
Total execution time = (8+1001) * 2 = 214
Starved time D_{2} over D_{1} = 416  214 = 202
Question 45 
A hardwired CPU uses 10 control signals S1 to S10, in various time steps T1 to T5, to implement 4 instructions I1 to I4 as shown below:
Which of the following pairs of expressions represent the circuit for generating control signals S5 and S10 respectively? ((Ij+Ik)Tn indicates that the control signal should be generated in time step Tn if the instruction being executed is Ij or lk)
S5=T1+I2⋅T3 and S10=(I1+I3)⋅T4+(I2+I4)⋅T5  
S5=T1+(I2+I4)⋅T3 and S10=(I1+I3)⋅T4+(I2+I4)⋅T5  
S5=T1+(I2+I4)⋅T3 and S10=(I2+I3+I4)⋅T2+(I1+I3)⋅T4+(I2+I4)⋅T5  
S5=T1+(I2+I4)⋅T3 and S10=(I2+I3)⋅T2+I4⋅T3+(I1+I3)⋅T4+(I2+I4)⋅T5 
→ If we look at the table, we need to find those timestamps which are using these control signals.
→ For example consider S5 = T1 has been used for control signal for all the instructions, or we can say that irrespective of the instruction.
→ Also S5 is used by instructions I2 and I4 for the timestamp T3 so that
S5 = T1 + I2⋅T3 + I4⋅T3 = T1 + (I2+I4)⋅T3
→ Like that
S10 = (I2+I3)⋅T2 + I4⋅T3 +(I1+I3)⋅T4 + (I2⋅I4)⋅T5
Question 46 
A line L in a circuit is said to have a stuckat0 fault if the line permanently has a logic value 0. Similarly a line L in a circuit is said to have a stuckat1 fault if the line permanently has a logic value 1. A circuit is said to have a multiple stuckat fault if one or more lines have stuck at faults. The total number of distinct multiple stuckat faults possible in a circuit with N lines is
3^{N}  
3^{N}  1  
2^{N}  1  
2 
This is because the total possible combinations (i.e., a line may either be at fault (in 2 ways i.e., stuck at 0 or 1) or it may not be, so there are only 3 possibilities for a line) is 3^{N}. In only one combination the circuit will have all lines to be correct (i.e., not a fault). Hence, total combinations in which distinct multiple stuckatfaults possible in a circuit with N lines is 3^{N}  1.
Question 47 
(34.4)_{8} × (23.4)_{8} evaluates to
(1053.6)_{8}  
(1053.2)_{8}  
(1024.2)_{8}  
None of these 
(34.4)_{8} = 3×8^{1} + 4×8^{0} + 4×8^{1}
= 24 + 4 + 0.5
= (28.5)_{10}
(23.4)_{8} = 2×8^{1} + 3×8^{0} + 4×8^{1}
= 16 + 3 + 0.5
= (19.5)_{10}
Now,
(28.5)_{10} × (19.5)_{01} = (555.75)_{10}
Now,
(555.75)_{10} = ( ? )_{8}
To convert the integer part,
We get, 1053.
To convert the fractional part, keep multiplying by 8 till decimal part becomes 0,
∴ (555.75)_{10} = (1053.6)_{8}
Question 48 
The circuit shown below implements a 2input NOR gate using two 24 MUX (control signal 1 selects the upper input). What are the values of signals x, y and z?
1, 0, B  
1, 0, A  
0, 1, B  
0, 1, A 
g = Ax + Bz'
In MUX2, the equation is
f = xg + yg'
= x(Az+Bz') + y(Az+Bz')'
Function f should be equal to (A+B)'.
Just try to put the values of option (D), i.e., x=0, y=1, z=A,
f = 0(AA+BA') +1(AA+BA')'
= (A+B)'
∴ Option (D) is correct.
Question 49 
n instruction set of a processor has 125 signals which can be divided into 5 groups of mutually exclusive signals as follows:
Group 1 : 20 signals, Group 2 : 70 signals, Group 3 : 2 signals, Group 4 : 10 signals, Group 5 : 23 signals.
How many bits of the control words can be saved by using vertical microprogramming over horizontal microprogramming?
0  
103  
22  
55 
= 20 + 70 + 2 + 10 + 23
= 125
Now lets consider vertical microprogramming. In vertical microprogramming no. of bits required to activate 1 signal in group of N signals, is ⌈log_{2} N⌉. And in the question 5 groups contains mutually exclusive signals,
group 1 = ⌈log_{2} 20⌉ = 5
group 2 = ⌈log_{2} 70⌉ = 7
group 3 = ⌈log_{2} 2⌉ = 1
group 4 = ⌈log_{2} 10⌉ = 4
group 5 = ⌈log_{2} 23⌉ = 5
Total bits required in vertical microprogramming
= 5 + 7 + 1 + 4 + 5
= 22
So, number of bits saved is
= 125  22
= 103
Question 50 
In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most 2. If the height of the tree is h > 0, then the minimum number of nodes in the tree is:
2^{h1}  
2^{h1} + 1  
2^{h}  1  
2^{h} 
Above tree satisfies the property given in the question. Hence, only option (B) satisfies it.
Question 51 
Let T(n) be a function defined by the recurrence T(n) = 2T(n/2) + √n for n ≥ 2 and T(1) = 1 Which of the following statements is TRUE?
T(n) = θ(log n)  
T(n) = θ(√n)  
T(n) = θ(n)  
T(n) = θ(n log n) 
Question 52 
Let G be a weighted undirected graph and e be an edge with maximum weight in G. Suppose there is a minimum weight spanning tree in G containing the edge e. Which of the following statements is always TRUE?
There exists a cutset in G having all edges of maximum weight  
There exists a cycle in G having all edges of maximum weight  
Edge e cannot be contained in a cycle  
All edges in G have the same weight 
(B) False, because the cutset of heaviest edge may contain only one edge.
(C) False. The cutset may form cycle with other edge.
(D) False. Not always true.
Question 53 
The following C function takes two ASCII strings and determines whether one is an anagram of the other. An anagram of a string s is a string obtained by permuting the letters in s.
int anagram (char *a, char *b) { int count [128], j; for (j = 0; j < 128; j++) count[j] = 0; j = 0; while (a[j] && b[j]) { A; B; } for (j = 0; j < 128; j++) if (count [j]) return 0; return 1; }
Choose the correct alternative for statements A and B.
A : count [a[j]]++ and B : count[b[j]]–  
A : count [a[j]]++ and B : count[b[j]]++  
A : count [a[j++]]++ and B : count[b[j]]–  
A : count [a[j]]++and B : count[b[j++]]– 
B: Decrements the count by 1 at each index that is equal to the ASCII value of the alphabet it is pointing at. Also it increments the loop counter for next iteration.
If one string is permutation of other, there would have been equal increments and decrements at each index of array, and so count should contain zero at each index, that is what the loop checks at last and if any nonzero elements is found, it returns 0 indicating that strings are not anagram to each other.
Question 54 
The following C function takes a singlylinked list of integers as a parameter and rearranges the elements of the list. The list is represented as pointer to a structure. The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the contents of the list after the function completes execution?
struct node { int value; struct node *next; ); void rearrange (struct node *list) { struct node *p, *q; int temp; if (!list  !list > next) return; p = list; q = list > next; while (q) { temp = p > value; p > value = q > value; q > value = temp; p = q > next; q = p ? p > next : 0; } }
1, 2, 3, 4, 5, 6, 7  
2, 1, 4, 3, 6, 5, 7  
1, 3, 2, 5, 4, 7, 6  
2, 3, 4, 5, 6, 7, 1 
Question 55 
A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the tree is traversed in preorder and the values in each node printed out, the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is traversed in postorder, the sequence obtained would be
8, 7, 6, 5, 4, 3, 2, 1  
1, 2, 3, 4, 8, 7, 6, 5  
2, 1, 4, 3, 6, 7, 8, 5  
2, 1, 4, 3, 7, 8, 6, 5 
5, 3, 1, 2, 4, 6, 8, 7
Inorder is the sorted sequence, i.e.,
1, 2, 3, 4, 5, 6, 7, 8
And we know that with given inorder and preorder, we can draw a unique BST.
So, the BST will be,
Hence, postorder traversasl sequence is,
2, 1, 4, 3, 7, 8, 6, 5
Question 56 
Let G be a directed graph whose vertex set is the set of numbers from 1 to 100. There is an edge from a vertex i to a vertex j iff either j = i + 1 or j = 3i. The minimum number of edges in a path in G from vertex 1 to vertex 100 is
4  
7  
23  
99 
j = i +1
(or)
j = 3i
Second option will help us reach from 1 to 100 rapidly. The trick to solve this question is to think in reverse way. Instead of finding a path from 1 to 100, try to find a path from 100 to 1.
So, the edge sequence with minimum number of edges is
1 → 3 → 9 → 10 → 11 → 33 → 99 → 100
which consists of 7 edges.
Question 57 
What is the output printed by the following program?
#includeint f(int n, int k) { if (n == 0) return 0; else if (n % 2) return f(n/2, 2*k) + k; else return f(n/2, 2*k)  k; } int main () { printf("%d", f(20, 1)); return 0; }
5  
8  
9  
20 
Hence, 9 is the answer.
Question 58 
Let a be an array containing n integers in increasing order. The following algorithm determines whether there are two distinct numbers in the array whose difference is a specified number S > 0.
i = 0; j = 1; while (j < n ) { if (E) j++; else if (a[j]  a[i] == S) break; else i++; } if (j < n) printf("yes") else printf ("no");
Choose the correct expression for E.
a[j] – a[i] > S  
a[j] – a[i] < S  
a[i] – a[j] < S  
a[i] – a[j] > S 
If at times difference becomes greater than S we know that it won't reduce further for same 'i' and so we increment the 'i'.
Question 59 
Let a and b be two sorted arrays containing n integers each, in nondecreasing order. Let c be a sorted array containing 2n integers obtained by merging the two arrays a and b. Assuming the arrays are indexed starting from 0, consider the following four statements
1. a[i] ≥ b [i] => c[2i] ≥ a [i] 2. a[i] ≥ b [i] => c[2i] ≥ b [i] 3. a[i] ≥ b [i] => c[2i] ≤ a [i] 4. a[i] ≥ b [i] => c[2i] ≤ b [i]Which of the following is TRUE?
only I and II  
only I and IV  
only II and III  
only III and IV 
Since both 'a' and 'b' are sorted in the beginning, there are 'i' elements than or equal to a[i] and similarly 'i' elements smaller than or equal to b[i]. So, a[i] ≥ b[i] means there are 2i elements smaller than or equal to a[i] and hence in the merged array, a[i] will come after these 2i elements. So, c[2i] ≤ a[i].
Similarly, a[i] ≥ b[i] says for b that, there are not more than 2i elements smaller than b[i] in the sorted array. So, b[i] ≤ c[2i].
So, option (C) is correct.
Question 60 
We wish to schedule three processes P1, P2 and P3 on a uniprocessor system. The priorities, CPU time requirements and arrival times of the processes are as shown below.
Process Priority CPU time required Arrival time (hh:mm:ss) P1 10(highest) 20 sec 00:00:05 P2 9 10 sec 00:00:03 P3 8 (lowest) 15 sec 00:00:00We have a choice of preemptive or nonpreemptive scheduling. In preemptive scheduling, a latearriving higher priority process can preempt a currently running process with lower priority. In nonpreemptive scheduling, a latearriving higher priority process must wait for the currently executing process to complete before it can be scheduled on the processor. What are the turnaround times (time from arrival till completion) of P2 using preemptive and nonpreemptive scheduling respectively.
30 sec, 30 sec  
30 sec, 10 sec  
42 sec, 42 sec  
30 sec, 42 sec 
TAT of P2 = Completion time of P2  Arrival time of P2
= 33  3
= 30 sec
For nonpreemptive,
TAT of P2 = Completion time of P2  Arrival time of P2
= 45  3
= 42 sec
Question 61 
Consider a 2way set associative cache memory with 4 sets and total 8 cache blocks (07) and a main memory with 128 blocks (0127). What memory blocks will be present in the cache after the following sequence of memory block references if LRU policy is used for cache block replacement. Assuming that initially the cache did not have any memory block from the current job?
0 5 3 9 7 0 16 55
0 3 5 7 16 55  
0 3 5 7 9 16 55  
0 5 7 9 16 55  
3 5 7 9 16 55 
So,
Since, each set has only 2 places, 3 will be thrown out as its the least recently used block. So final content of cache will be
0 5 7 9 16 55
Hence, answer is (C).
Question 62 
Two shared resources R_{1} and R_{2} are used by processes P_{1} and P_{2}. Each process has a certain priority for accessing each resource. Let T_{ij} denote the priority of P_{i} for accessing R_{j}. A process P_{i} can snatch a resource Rh from process P_{j} if T_{ik} is greater than T_{jk}. Given the following:
(I) T_{11} > T_{21} (II) T_{12} > T_{22} (III) T_{11} < T_{21} (IV) T_{12} < T_{22}Which of the following conditions ensures that P_{1} and P_{2} can never deadlock?
(I) and (IV)  
(II) and (III)  
(I) and (II)  
None of the above 
Question 63 
In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can’t mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the book keeping information for the blocks allocated for storing the file. A disk block can store either bookkeeping information for a file or data from a file, but not both.
What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?
35400 and 35800 bytes  
35800 and 35400 bytes  
35600 and 35400 bytes  
35400 and 35600 bytes 
11050 = 111 blocks requiring 111×4 = 444B of bookkeeping into which requires another 5 disk blocks. So, totally 111+5 = 116 disk blocks. Similarly,
4990 = 50 + ⌈(50×4)/100⌉ = 52
5170 = 52 + ⌈(52×4)/100⌉ = 55
12640 = 127 + ⌈(127×4)/100⌉ = 133
∴ Total no. of blocks required
= 52 + 55 + 133 + 116
= 356
So, total space required
= 35600 Bytes
For 200 Bytes block:
56 + ⌈(56×4)/200⌉ = 58
25 + ⌈(25×4)/200⌉ = 26
26 + ⌈(26×4)/200⌉ = 27
64 + ⌈(64×4)/200⌉ = 66
∴ Total space required,
(58+26+27+66) × 200
= 177 × 200
= 35400 Bytes
Question 64 
The availability of a complex software is 90%. Its Mean Time Between Failure (MTBF) is 200 days. Because of the critical nature of the usage, the organization deploying the software further enhanced it to obtain an availability of 95%. In the process, the Mean Time To Repair (MTTR) increased by 5 days.
What is the MTBF of the enhanced software?
205 days  
300 days  
500 days  
700 days 
Question 65 
To carry out white box testing of a program, its flow chart representation is obtained as shown in the figure below:
For basis path based testing of this program, its cyclomatic complexity is
5  
4  
3  
2 
Question 66 
In a data flow diagram, the segment shown below is identified as having transaction flow characteristics, with p2 identified as the transaction center
A first level architectural design of this segment will result in a set of process modules with an associated invocation sequence. The most appropriate architecture is
p1 invokes p2, p2 invokes either p3, or p4, or p5  
p2 invokes p1, and then invokes p3, or p4, or p5  
A new module Tc is defined to control the transaction flow. This module Tc first invokes p1 and then invokes p2, p2 in turn invokes p3, or p4, or p5  
A new module Tc is defined to control the transaction flow. This module Tc invokes p2, p2 invokes p1, and then invokes p3, or p4, or p5 
Question 67 
A company maintains records of sales made by its salespersons and pays them commission based on each individual's total sales made in a year. This data is maintained in a table with following schema:
salesinfo = (salespersonid, totalsales, commission)
In a certain year, due to better business results, the company decides to further reward its salespersons by enhancing the commission paid to them as per the following formula:
If commission < = 50000, enhance it by 2% If 50000 < commission < = 100000, enhance it by 4% If commission > 100000, enhance it by 6%
The IT staff has written three different SQL scripts to calculate enhancement for each slab, each of these scripts is to run as a separate transaction as follows:
T1: Update salesinfo Set commission = commission * 1.02 Where commission < = 50000; T2: Update salesinfo Set commission = commission * 1.04 Where commission > 50000 and commission is < = 100000; T3: Update salesinfo Set commission = commission * 1.06 Where commission > 100000;Which of the following options of running these transactions will update the commission of all salespersons correctly
Execute T1 followed by T2 followed by T3  
Execute T2, followed by T3; T1 running concurrently throughout  
Execute T3 followed by T2; T1 running concurrently throughout  
Execute T3 followed by T2 followed by T1

In other cases some people will get two times increment, for example,
if we have T1 followed by T2 and if initial commission is 49500, then he is belonging to <50000.
Hence, 49500 * 1.02 = 50490.
Now again he is eligible for second category. So, he will get again increment as,
50490 * 1.04 = 52509.6
So he will get increment two times, but he is eligible for only one slab of commission.
Question 68 
A table 'student' with schema (roll, name, hostel, marks), and another table 'hobby' with schema (roll, hobbyname) contains records as shown below:
Table: Student ROLL NAME HOSTEL MARKS 1798 Manoj Rathod 7 95 2154 Soumic Banerjee 5 68 2369 Gumma Reddy 7 86 2581 Pradeep Pendse 6 92 2643 Suhas Kulkarni 5 78 2711 Nitin Kadam 8 72 2872 Kiran Vora 5 92 2926 Manoj Kunkalikar 5 94 2959 Hemant Karkhanis 7 88 3125 Rajesh Doshi 5 82 Table: hobby ROLL HOBBYNAME 1798 chess 1798 music 2154 music 2369 swimming 2581 cricket 2643 chess 2643 hockey 2711 volleyball 2872 football 2926 cricket 2959 photography 3125 music 3125 chess
The following SQL query is executed on the above tables:
select hostel from student natural join hobby where marks >= 75 and roll between 2000 and 3000;
Relations S and H with the same schema as those of these two tables respectively contain the same information as tuples. A new relation S’ is obtained by the following relational algebra operation:
S’ = ∏_{hostel} ((σ_{s.roll = H.roll}(σ_{marks > 75 and roll > 2000 and roll < 3000} (S)) X (H))
The difference between the number of rows output by the SQL statement and the number of tuples in S’ is
6  
4  
2  
0 
Total 7 rows are selected.
Where in relational algebra only distinct values of hostels are selected,i.e., 5, 6, 7 (3 rows).
∴ Answer is 7  3 = 4
Question 69 
In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold information on which items are supplied by which suppliers, and which warehouse keeps which items along with the stocklevel of these items.
Supply = (supplierid, itemcode)
Inventory = (itemcode, warehouse, stocklevel)
For a specific information required by the management, following SQL query has been written
Select distinct STMP.supplierid From Supply as STMP Where not unique (Select ITMP.supplierid From Inventory, Supply as ITMP Where STMP.supplierid = ITMP.supplierid And ITMP.itemcode = Inventory.itemcode And Inventory.warehouse = 'Nagpur');For the warehouse at Nagpur, this query will find all suppliers who
do not supply any item  
supply exactly one item  
supply one or more items  
supply two or more items 
Question 70 
In a schema with attributes A, B, C, D and E following set of functional dependencies are given
A → B A → C CD → E B → D E → AWhich of the following functional dependencies is NOT implied by the above set?
CD → AC  
BD → CD  
BC → CD  
AC → BC 
Option (B):
BD → CD
BD^{+} = BD
i.e., BD cannot derive CD and hence is not implied.
Question 71 
A network with CSMA/CD protocol in the MAC layer is running at 1 Gbps over a 1 km cable with no repeaters. The signal speed in the cable is 2 × 10^{8} m/sec. The minimum frame size for this network should be
10000 bits  
10000 bytes  
5000 bits  
5000 bytes 
L ≤ 2×T_{p}×B
L ≤ 2×(d/v)×B
d = 1Km = 1000m
v = 2×10^{3} m/s
B = 10^{9} bps
By solving the above equation we will set the value of L as,
10000 bits.
Question 72 
A channel has a bit rate of 4 kbps and oneway propagation delay of 20 ms. The channel uses stop and wait protocol. The transmission time of the acknowledgement frame is negligible. To get a channel efficiency of at least 50%, the minimum frame size should be
80 bytes  
80 bits  
160 bytes  
160 bits 
Question 73 
On a TCP connection, current congestion window size is Congestion Window=4 KB. The window size advertised by the receiver is Advertise Window=6 KB. The last byte sent by the sender is LastByteSent=10240 and the last byte acknowledged by the receiver is LastByteAcked=8192. The current window size at the sender is
2048 bytes  
4096 bytes  
6144 bytes  
8192 bytes 
= min (4KB, 6KB)
= 4KB
Question 74 
In a communication network, a packet of length L bits takes link L1 with a probability of p_{1} or link L2 with a probability of p_{2}. Link L1 and L2 have bit error probability of b_{1}and b_{2 }respectively. The probability that the packet will be received without error via either L1 or L2 is
(1 – b_{1})^{L} p_{1} + (1 – b_{2})^{L}p_{2}  
[1 – (b_{1 + b2)L]p1p2}  
(1 – b_{1})^{L} (1 – b_{2})^{L}p_{1}p_{2}  
1 – (b_{1} ^{L}p_{1} + b_{2} ^{L}p_{2}) 
Probability for no bit error for any single bit = (1  b_{1})
Similarly, for link L_{2},
Probability of no bit error = (1  b_{2})
Packet can go either through link L_{1} or L_{2}, they are mutually exclusive events.
Probability packet will be received without any error = Probability of L_{1} being chosen and no errors in any of L bits + Probability of L_{2} being chosen and no error in any of the L bits
= (1  b_{1})^{L} p_{1} + (1  b_{2})^{L} p_{2}
Hence, answer is option A.
Question 75 
In a TDM medium access control bus LAN, each station is assigned one time slot per cycle for transmission. Assume that the length of each time slot is the time to transmit 100 bits plus the endtoend propagation delay. Assume a propagation speed of 2 × 10^{8} m/sec. The length of the LAN is 1 km with a bandwidth of 10 Mbps. The maximum number of stations that can be allowed in the LAN so that the throughput of each station can be 2/3 Mbps is
3  
5  
10  
20 
Question 76 
A company has a class C network address of 204.204.204.0. It wishes to have three subnets, one with 100 hosts and two with 50 hosts each. Which one of the following options represents a feasible set of subnet address/subnet mask pairs?
204.204.204.128/255.255.255.192 204.204.204.0/255.255.255.128 204.204.204.64/255.255.255.128  
204.204.204.0/255.255.255.192 204.204.204.192/255.255.255.128 204.204.204.64/255.255.255.128  
204.204.204.128/255.255.255.128 204.204.204.192/255.255.255.192 204.204.204.224/255.255.255.192  
204.204.204.128/255.255.255.128 204.204.204.64/255.255.255.192 204.204.204.0/255.255.255.192 
10000000/128 (mask)  subnet id bit (1) (subnet 1)
01000000/192 (mask)  subnet id bit (01) (subnet 2)
0000000/192 (mask)  subnet id bit (00) (subnet 3)
Question 77 
Assume that “host1.mydomain.dom” has an IP address of 145.128.16.8. Which of the following options would be most appropriate as a subsequence of steps in performing the reverse lookup of 145.128.16.8? In the following options “NS” is an abbreviation of “nameserver”.
Query a NS for the root domain and then NS for the “dom” domains  
Directly query a NS for “dom” and then a NS for “mydomain.dom” domains  
Query a NS for inaddr.arpa and then a NS for 128.145.inaddr.arpa domains  
Directly query a NS for 145.inaddr.arpa and then a NS for 128.145.inaddr.arpa domains 
First we need to locate inaddr.apra, then perform reverse lookup of 8.16.128.145.inaddr.arpa which will point to host1.mydomain.com.
Question 78 
Consider the following message M = 1010001101. The cyclic redundancy check (CRC) for this message using the divisor polynomial x^{5} + x^{4} + x^{2} + 1 is:
01110  
01011  
10101  
10110 
M = 1010001101
append 5 zeroes = M = 101000110100000
∴ CRC = 01110
Question 79 
Suppose that two parties A and B wish to setup a common secret key (DH key) between themselves using the DiffieHellman key exchange technique. They agree on 7 as the modulus and 3 as the primitive root. Party A chooses 2 and party B chooses 5 as their respective secrets. Their DH key is
3  
4  
5  
6 
where p is the primitive root and n is the modulus and 'a' and 'b' are the secret values selected by parity A & B.
So answer is,
3^{2×5} mod 7 = 3^{10} mod 7 = 4
Question 80 
Given below is an excerpt of an xml specification.
Given below are several possible excerpts from "library.dtd". For which excerpt would the above specification be valid?
Question 81 
A disk has 8 equidistant tracks. The diameters of the innermost and outermost tracks are 1 cm and 8 cm respectively. The innermost track has a storage capacity of 10 MB.
What is the total amount of data that can be stored on the disk if it is used with a drive that rotates it with (i) Constant Linear Velocity (ii) Constant Angular Velocity?
(i) 80 MB (ii) 2040 MB  
(i) 2040 MB (ii) 80 MB  
(i) 80 MB (ii) 360 MB  
(i) 80 MB (ii) 360 MB 
Diameter of inner track = d = 1 cm
Circumference of inner track
= 2 * 3.14 * d/2
= 3.14 cm
Storage capacity = 10 MB (given)
Circumference of all equidistant tracks
= 2 * 3.14 * (0.5+1+1.5+2+2.5+3+3.5+4)
= 113.14 cm
Here, 3.14 cm holds 10 MB
Therefore, 1 cm holds 3.18 MB.
So, 113.14 cm holds
113.14 * 3.18 = 360 MB
So, total amount of data that can be hold on the disk = 360 MB.
For constant angular velocity:
In case of CAV, the disk rotates at a constant angular speed. Same rotation time is taken by all the tracks.
Total amount of data that can be stored on the disk
= 8 * 10 = 80 MB
Question 82 
A disk has 8 equidistant tracks. The diameters of the innermost and outermost tracks are 1 cm and 8 cm respectively. The innermost track has a storage capacity of 10 MB.
If the disk has 20 sectors per track and is currently at the end of the 5^{th} sector of the innermost track and the head can move at a speed of 10 meters/sec and it is rotating at constant angular velocity of 6000 RPM, how much time will it take to read 1 MB contiguous data starting from the sector 4 of the outermost track?
13.5 ms  
10 ms  
9.5 ms  
20 ms 
So, the header has to seek (4  0.5) = 3.5cm.
For 10m  1s
1m  1/10 s
100cm  1/(10×100) s
3.5cm  3.5/1000 s = 3.5ms
So, the header will take 3.5ms.
Now, angular velocity is constant and header is now at end of 5^{th} sector. To start from front of 4^{th} sector it must rotate upto 18 sector.
6000 rotation in 60000ms.
1 rotation in 10ms (time to traverse 20 sectors).
So, to traverse 18 sectors, it takes 9ms.
In 10ms, 10MB data is read.
So, 1MB data can be read in 1ms.
∴ Total time = 1+9+3.5 = 13.5ms
Question 83 
A database table T1 has 2000 records and occupies 80 disk blocks. Another table T2 has 400 records and occupies 20 disk blocks. These two tables have to be joined as per a specified join condition that needs to be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly one block of records for T1 and one block of records for T2 simultaneously at any point in time. No index is available on either table.
If Nestedloop join algorithm is employed to perform the join, with the most appropriate choice of table to be used in outer loop, the number of block accesses required for reading the data are
800000  
40080  
32020  
100 
Therefore,
putting 2^{nd} table outside,
for every 400 records {
80 block accesses in first table
}
= 32000 blocks
and also 20 blocks accesses of outer table.
So, answer comes out to be,
32000 + 20 = 32020
Question 84 
A database table T1 has 2000 records and occupies 80 disk blocks. Another table T2 has 400 records and occupies 20 disk blocks. These two tables have to be joined as per a specified join condition that needs to be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly one block of records for T1 and one block of records for T2 simultaneously at any point in time. No index is available on either table.
If, instead of Nestedloop join, Block nestedloop join is used, again with the most appropriate choice of table in the outer loop, the reduction in number of block accesses required for reading the data will be
0  
30400  
38400  
798400 
400×80+20
= 32020 (calculated in previous question)
In block Nested loop join, the no. of block access will be
20×80+20 = 1620
∴ The difference is = 32020  1620 = 30400
Question 85 
Consider the contextfree grammar
E → E + E E → (E * E) E → idwhere E is the starting symbol, the set of terminals is {id, (,+,),*}, and the set of nonterminals is {E}.
Which of the following terminal strings has more than one parse tree when parsed according to the above grammar?
id + id + id + id  
id + (id* (id * id))  
(id* (id * id)) + id  
((id * id + id) * id) 
Question 86 
Consider the contextfree grammar
E → E + E
E → (E * E)
E → id
where E is the starting symbol, the set of terminals is {id, (,+,),*}, and the set of nonterminals is {E}.
For the terminal string id + id + id + id, how many parse trees are possible?
5  
4  
3  
2 
Question 87 
A sink in a directed graph is a vertex i such that there is an edge from every vertex j ≠ i to i and there is no edge from i to any other vertex. A directed graph G with n vertices is represented by its adjacency matrix A, where A[i] [j] = 1 if there is an edge directed from vertex i to j and 0 otherwise. The following algorithm determines whether there is a sink in the graph G.
i = 0 do { j = i + 1; while ((j < n) && E_{1}) j++; if (j < n) E_{2}; } while (j < n); flag = 1; for (j = 0; j < n; j++) if ((j! = i) && E_{3}) flag = 0; if (flag) printf("Sink exists"); else printf ("Sink does not exist");Choose the correct expressions for E_{1} and E_{2}
E_{1} : A[i][j] and E_{2} : i = j;  
E_{1} : !A[i][j] and E_{2} : i = j + 1;  
E_{1}: !A[i][j] and E_{2} : i = j;  
E_{1} : A[i][j] and E_{2} : i = j + 1; 
The first part of the code, is finding if there is any vertex which doesn't have any outgoing edge to any vertex coming after it in adjacency matrix. The smart part of the code is E_{2}, which makes rows slip when there is no edge from i to it, making it impossible for them to form a sink. This is done through
E_{1}: A[i][j]
and
E_{2}: i = j
E_{1} makes sure that there is no edge from i to j and i is a potential sink till A[i][j] becomes 1. If A[i][j] becomes 1, i can no longer be a sink. Similarly, all previous j can also not be a sink. Now, the next potential candidate for sink is j. So, in E_{2}, we must make i = j.
So, answer is (C).
Question 88 
A sink in a directed graph is a vertex i such that there is an edge from every vertex j ≠ i to i and there is no edge from i to any other vertex. A directed graph G with n vertices is represented by its adjacency matrix A, where A[i] [j] = 1 if there is an edge directed from vertex i to j and 0 otherwise. The following algorithm determines whether there is a sink in the graph G.
i = 0 do { j = i + 1; while ((j < n) && E_{1}) j++; if (j < n) E_{2}; } while (j < n); flag = 1; for (j = 0; j < n; j++) if ((j! = i) && E_{3}) flag = 0; if (flag) printf("Sink exists"); else printf("Sink does not exist");Choose the correct expressions for E_{3}
(A[i][j] && !A[j][i])  
(!A[i][j] && A[j][i])  
(!A[i][j]   A[j][i])  
(A[i][j]   !A[j][i]) 
Now, the loop breaks when we found a potential sinkthat is a vertex which does not have any outgoing edge to any coming after it in adjacency matrix.
So, if the column in which this vertex comes is all 1's and the row is all 0's (except diagonal), this is the sink. Otherwise there is no sink in the graph. So, E_{3} is checking this condition. But in the code flag is used for storing the state that sink is present or not. And as per the usage of flag in code, by default sink is considered present.
So, the condition is E_{3} must make flag = 0, if the found i is not a sink. So, the condition should be
A[i][j]   !A[j][i]
So, option (D) is the answer.
Question 89 
Consider a simple graph with unit edge costs. Each node in the graph represents a router. Each node maintains a routing table indicating the next hop router to be used to relay a packet to its destination and the cost of the path to the destination through that router. Initially, the routing table is empty. The routing table is synchronously updated as follows. In each updation interval, three tasks are performed.
1. A node determines whether its neighbours in the graph are accessible. If so, it sets the tentative cost to each accessible neighbour as 1. Otherwise, the cost is set to ∞.
2. From each accessible neighbour, it gets the costs to relay to other nodes via that neighbour (as the next hop).
3. Each node updates its routing table based on the information received in the previous two steps by choosing the minimum cost.
For the graph given above, possible routing tables for various nodes after they have stabilized, are shown in the following options. Identify the correct table.
Question 90 
Consider a simple graph with unit edge costs. Each node in the graph represents a router. Each node maintains a routing table indicating the next hop router to be used to relay a packet to its destination and the cost of the path to the destination through that router. Initially, the routing table is empty. The routing table is synchronously updated as follows. In each updation interval, three tasks are performed.
1. A node determines whether its neighbours in the graph are accessible. If so, it sets the tentative cost to each accessible neighbour as 1. Otherwise, the cost is set to ∞.
2. From each accessible neighbour, it gets the costs to relay to other nodes via that neighbour (as the next hop).
3. Each node updates its routing table based on the information received in the previous two steps by choosing the minimum cost.
Continuing from the earlier problem, suppose at some time t, when the costs have stabilized, node A goes down. The cost from node F to node A at time (t + 100) is
>100 but finite  
∞  
3  
>3 and ≤100 
The distance between A and the nodes B, D, F respectively are:
t: 1 2 3
t + 1: 3 2 3
t + 2: 3 4 3
t + 3: 5 4 5
t + 4: 5 6 5
t + 5: 7 6 7
t + 6: 7 8 7
t + 7: 9 8 9
t + 8: 9 to 10
and this continues.
So, in every two steps they get incremented by 2.
So,
at t + 99, F is 101
at t + 100, F is 101.