## Gate IT 2008

Question 1 |

EX-NOR | |

implication, negation | |

OR, negation | |

NAND |

**Gate IT 2008**

**Discuss it**

**Kriti Kushwaha**.

Question 2 |

11/12 | |

10/12 | |

9/12 | |

8/12 |

**Probability**

**Gate IT 2008**

**Discuss it**

Question 3 |

2 | |

3 | |

4 | |

5 |

**Graph Theory**

**Gate IT 2008**

**Discuss it**

Question 4 |

5 | |

4 | |

3 | |

2 |

**Analysis of Algorithms**

**Gate IT 2008**

**Discuss it**

0----0----0----0----0----0----0----0----0

Question 5 |

(0 + 1) * 11(0 + 1) * | |

0 * 110 * | |

0 * 10 * 10 * | |

(0 + 1) * 1(0 + 1) * 1 (0 + 1) * |

**Regular languages and finite automata**

**Gate IT 2008**

**Discuss it**

Between B and C both contains exactly two 1's but in option B, both 1 will always come together where as in C it is general string.

Question 6 |

m ≤ 2 ^{n} | |

n ≤ m | |

M has one accept state | |

m = 2 ^{n} |

**Regular languages and finite automata**

**Gate IT 2008**

**Discuss it**

=> set of states of NFA =n

=> no of subsets of a set with n elements = 2

^{n}

=> m<=2

^{n}

Question 7 |

-10 | |

-13 | |

-26 | |

None of these |

**Digital Logic & Number representation**

**Number Representation**

**Gate IT 2008**

**Discuss it**

^{4}=16. 127 is the unique number for 32 bit floating point representation. It is known as bias. It is determined by 2

^{k-1}-1 where 'k' is the number of bits in exponent field. Thus bias = 3 for 8 bit conversion and 127 for 32 bit. (2

^{8-1}-1 = 128-1=127) Mantissa is calculated from the remaining 24 bits of the binary representation. It consists of '1' and a fractional part which is determined by: The fractional part of mantissa is given by: 1*(1/2) + 0*(1/4) + 1*(1/8) + 0*(1/16) +.........=0.625 Thus the mantissa will be 1+0.625=1.625 The decimal number hence given as Sign*Exponent*Mantissa = (-1)*(16)*(1.625) = -26. Related : https://www.youtube.com/watch?v=03fhijH6e2w http://quiz.geeksforgeeks.org/number-representation/ This solution is contributed by

**Kriti Kushwaha**.,

Question 8 |

independent of one variable | |

independent of two variables | |

independent of three variable | |

dependent on all the variables |

**Gate IT 2008**

**Discuss it**

A'B' | A'B | AB | AB' | ||

00 | 01 | 11 | 10 | ||

A'B' | 00 | 1 | 1 | ||

A'B | 01 | 1 | 1 | ||

AB | 11 | 1 | 1 | ||

AB' | 10 | 1 | 1 | 1 | 1 |

A'B' | A'B | AB | AB' | ||

00 | 0 1 | 11 | 10 | ||

A'B' | 00 | 1 | 1 | ||

A'B | 01 | 1 | 1 | ||

AB | 11 | 1 | 1 | ||

AB' | 10 | 1 | 1 | 1 | 1 |

**Kriti Kushwaha**.

Question 10 |

A. n

^{1/3}

B. e

^{n}

C. n

^{7/4}

D. n log

^{9}n

E. 1.0000001

^{n}

A, D, C, E, B | |

D, A, C, E, B | |

A, C, D, E, B | |

A, C, D, B, E |

**Analysis of Algorithms**

**Gate IT 2008**

**Discuss it**

Question 11 |

If X can be solved in polynomial time, then so can Y | |

X is NP-complete | |

X is NP-hard | |

X is in NP, but not necessarily NP-complete |

**NP Complete**

**Gate IT 2008**

**Discuss it**

In order to solve these type of questions in GATE, we will give 2 important theorems. Proofs of these is beyond the scope of this explanation. For Proofs please refer to Introduction To Algorithms by Thomas Cormen.

**Theorem - 1
**When a given Hard Problem (NPC, NPH and Undecidable Problems) is reduced to an unknown problem in polynomial time, then unknown problem also becomes Hard.

*Case - 1 * When NPC(NP-Complete) problem is reduced to unknown problem, unknown problem becomes NPH(NP-Hard).

*Case - 2* When NPH(NP-Hard) problem is reduced to unknown problem, unknown problem becomes NPH(NP-Hard).

*Case - 3* When undecidable problem is reduced to unknown problem, unknown problem becomes also becomes undecidable.

Remember that Hard problems needs to be converted for this theorem but not the other way.

**Theorem - 2**

When an unknown problem is reduced to an Easy problem(P or NP) in polynomial time, then unknown problem also becomes easy.

*Case - 1 * When an unknown problem is reduced to a P type problem, unknown problem also becomes P.

*Case - 2* When an unknown problem is reduced to a NP type problem, unknown problem also becomes NP.

Remember that unknown problems needs to be converted for this theorem to work but not the other way.

In the given question, X which is unknown problem is reduced to NPC problem in polynomial time so Theorem - 1 will not work. But all NPC problems are also NP, so we can say that X is getting reduced to a known NP problem so that **Theorem - 2 **is applicable and X is also NP. In order to make it NPC, we have to prove it NPH first which is not the case as Y is not getting reduced to X.

This solution is contributed by **Pranjul Ahuja**.

Question 12 |

The cost of searching an AVL tree is θ (log n) but that of a binary search tree is O(n) | |

The cost of searching an AVL tree is θ (log n) but that of a complete binary tree is θ (n log n) | |

The cost of searching a binary search tree is O (log n ) but that of an AVL tree is θ(n) | |

The cost of searching an AVL tree is θ (n log n) but that of a binary search tree is O(n) |

**Analysis of Algorithms**

**Balanced Binary Search Trees**

**Gate IT 2008**

**Discuss it**

AVL tree's time complexity of searching = θ(logn)

But a binary search tree, may be skewed tree, so in worst case BST searching time = θ(n)

Question 13 |

I-c, II-d, III-b, IV-a | |

I-a, II-d, III-c, IV-b | |

I-d, II-c, III-b, IV-a | |

I-c, II-d, III-a, IV-b |

**Principles of Programming Languages**

**Gate IT 2008**

**Discuss it**

Question 14 |

1, 1, 0 | |

1, 0, 0 | |

0, 1, 0 | |

1, 0, 1 |

**Digital Logic & Number representation**

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

+11101001

------------

100110110

carry flag =1

overflow happens only when two same sign numbers are added and carry generated is different from both added numbers.

so, overflow flag = 0,

sign bit = 0

Question 15 |

54 | |

60 | |

65 | |

75 |

**Memory Management**

**Gate IT 2008**

**Discuss it**

Question 16 |

(S1) Statement coverage cannot guarantee execution of loops in a program under test.

(S2) Use of independent path testing criterion guarantees execution of each loop in a program under test more than once.

True, True | |

True, False | |

False, True | |

False, False |

**Software Engineering**

**Gate IT 2008**

**Discuss it**

Question 17 |

10,000 bytes | |

12,000 bytes | |

15,000 bytes | |

27,000 bytes |

**Data Link Layer**

**Misc Topics in Computer Networks**

**Gate IT 2008**

**Discuss it**

15 sec------->9600*15 bits

given, 1 parity bit+2 stop bits + 1 start bit

=> 12 bits extra each frame

=> 9600*15/12 = 12000bytes

Question 18 |

It is derived from SGML | |

It describes content and layout | |

It allows user defined tags | |

It is restricted only to be used with web browsers |

**HTML and XML**

**Gate IT 2008**

**Discuss it**

both xml and html are derivative of SGML

Both xml and html describes layout and content

both are restricted to be used with web browsers

xml allows user defined tags but HTML-4 does not

Question 19 |

I-a, II-d, III-c, IV-b | |

I-b, II-d, III-c, IV-a | |

I-a, II-c, III-d, IV-b | |

I-b, II-c, III-d, IV-a |

**Misc Topics in Computer Networks**

**Gate IT 2008**

**Discuss it**

Question 20 |

[β→(∃x,α(x))]→[∀x,β→α(x)] | |

[∃x,β→α(x)]→[β→(∀x,α(x))] | |

[(∃x,α(x))→β]→[∀x,α(x)→β] | |

[(∀x,α(x))→β]→[∀x,α(x)→β] |

**Propositional and First Order Logic.**

**Gate IT 2008**

**Discuss it**

**option (a)**[β→(∃x,α(x))] → [∀x,β→α(x)] LHS: If β is true, then there exists an x for which α(x) is true. RHS: For all x, if β is true then α(x) is true. This is same as saying if β is true then for all x, α(x) is true. (β⟹∀x,α(x)) So, RHS⟹LHS and LHS⟹̸ RHS.

**Option (b)**[∃x,β→α(x)] → [β→(∀x,α(x))] LHS: There exists an x such that if β is true then α(x) is true. RHS: If β is true then for all x, α(x) is true. So, RHS⟹LHS and LHS⟹̸ RHS.

**Option (c)**[(∃x,α(x))→β] → [∀x,α(x)→β] LHS: If there is an x such that α(x) is true, then β is true. RHS: For all x, if α(x) is true, then β is true. Here, both LHS and RHS are same because β is a formula with no free variable which is independent of x. (if β is true for one x, it is true for every x and vice versa). So, RHS⟹LHS and LHS⟹RHS.

**Option (d)**[(∀x,α(x))→β]→[∀x,α(x)→β] RHS: For every x, if α(x) is true then β is true. So, RHS⟹LHS and LHS⟹̸ RHS So, option c is correct one. because for option c, LHS and RHS being equivalent, even if the implication is reversed, it remains valid. This solution is contributed by

**Nitika Bansal**.

Question 21 |

[∃ x, α → (∀y, β → (∃u, ∀ v, y))] | |

[∃ x, α → (∀y, β → (∃u, ∀ v, ¬y))] | |

[∀ x, ¬α → (∃y, ¬β → (∀u, ∃ v, ¬y))] | |

[∃ x, α ʌ (∀y, β ʌ (∃u, ∀ v, ¬y))] |

**Propositional and First Order Logic.**

**Gate IT 2008**

**Discuss it**

**Nitika Bansal**.

Question 22 |

A | |

B | |

C | |

D |

**Probability**

**Gate IT 2008**

**Discuss it**

Question 23 |

27 | |

28 | |

29 | |

30 |

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

=> Below 11, there will be no factor of 11

11*12*13*14*........22.......33........44...........55.......66.....77....88...99...110...121....132.....

# # # # # # # # # # (11*11) (11*12)

143.........154......165.....176.....187......198.......209.....220.....231....242.....253....264.....275 11*11*2 ....286......297

Total count of 11's = 29

Question 24 |

[(n+b-1)!(n+r-1)!]/[(n-1)!b!(n-1)!r!] | |

[(n+(b+r)-1)!]/[(n-1)!(n-1)!(b+r)!] | |

n!/(b!r!) | |

[(n+(b+r)-1)!]/[n!(b+r-1)!] |

**Probability**

**Gate IT 2008**

**Discuss it**

**Nitika Bansal**.

Question 25 |

(S1) the set of real numbers

(S2) {(a + ib) | a and b are rational numbers}

(S3) {a + ib | (a

^{2}+ b

^{2}) ≤ 1}

(S4) {ia | a is real}

only S1 | |

S1 and S3 | |

S2 and S3 | |

S1 and S2 |

**Gate IT 2008**

**Discuss it**

=> (0.3+0.4i)+(0.7+0.6i)=1+i

Both (0.3+0.4i) and (0.7+0.6i)

Complex numbers follows S3 but Addition of them does not follows

=>1+i, (a

^{2}+b

^{2})<=1

=> 1+1 is not less than equal to 1

S4: {ia |a is real}

There is no multiplicative identity exists (that is 1)

S1: It is closed under both * and +

As real + real =real and real * real = real

S2: It is closed as rational + rational = rational and rational * rational = rational

Question 26 |

regular | |

Complete | |

Hamiltonian | |

Euler |

**Graph Theory**

**Gate IT 2008**

**Discuss it**

And number of Odd degree vertices should be even.

So degree of this new node will be Even and as a new edge is formed between this new node and all other nodes of Odd degree hence here is not a single node exists with degree Odd

=> Euler Graph

Question 27 |

(i) and (iv) only | |

(ii) and (iii) only | |

(iii) only | |

(i), (ii) and (iv) only |

**Gate IT 2008**

**Discuss it**

Question 28 |

S3 and S2 | |

S1 and S4 | |

S1 and S3 | |

S1, S2 and S3 |

**Gate IT 2008**

**Discuss it**

**Properties of singular matrix:**Singular matrices are those where some rows or columns can be expressed by a linear combination of others. here M is a square matrix with zero determinant i.e. M is singular |M|=0

**Statements(s1,s2): correct**BY using property of singular matrix, we can see that columns or rows do not contain additional information.They are redundant and using row elimination or column elimination, matrix determinant is equal to zero.so it can be represented as linear combinations.

**Statement (s3): correct**As |M| is equal to zero,it will give non trivial solution. as matrix properties say, for a non trivial solution, determinat should be equal to zero.

**Statement(s4)**: incorrect Let us understand this concept in detail. We know that the formula for finding the inverse of a square matrix M is: M −1 = adjoint(M)/|M| If |M| = 0, then M −1 would given an indeterminate form; i.e. its inverse will not exist. Note: this comes into the basic fundamental of matrix.so read basics. This solution is contributed by

**Nitika Bansal**.

Question 30 |

Set of all strings that do not end with ab | |

Set of all strings that begin with either an a or a b | |

Set of all strings that do not contain the substring ab, | |

The set described by the regular expression b*aa*(ba)*b* |

**Regular languages and finite automata**

**Gate IT 2008**

**Discuss it**

**(A)**. Set of all strings that do not end with ab - This statement could be proved right by looking at the b labeled incident edges on the final states and a labeled edges preceding them. Complement of the given DFA will have first two states as final states. First state doesn’t have any b labeled edge that has a labeled edge prior to it. Similarly, second final state doesn’t have any such required b labeled edge. Similarly, it could be proven that all the strings accepted by the given DFA end with ab. Now that L ∪ complement(L) = (a + b) ∗ , L should be the set of all the strings ending on ab and complement(L) should be set of all the strings that do not end with ab. [CORRECT]

**(B)**. Set of all strings that begin with either an a or ab - This statement is incorrect. To prove that we just have to show that a string beginning with a or ab exists, which is accepted by the given DFA. String abaab is accepted by the given DFA, hence it won’t be accepted by its complement. [INCORRECT]

**(C)**. Set of all strings that do not contain the substring ab - To prove this statement wrong, we need to show that a string exists which doesn’t contain the substring ab and is not accepted by current DFA. Hence, it will be accepted by its complement, making this statement wrong. String aba is not accepted by this DFA. [INCORRECT]

**(D).**The set described by the regular expression b ∗ aa ∗ (ba) ∗ b ∗ - String abaaaba is not accepted by the given DFA, hence accepted by its com This solution is contributed by

**vineet purswani**.

Question 31 |

L

_{1}= {a

^{i}b

^{j}c

^{k}| i = j, k ≥ 1}

L

_{1}= {a

^{i}b

^{j}| j = 2i, i ≥ 0}

Which of the following is true?

L _{1} is not a CFL but L_{2} is | |

L _{1} ∩ L_{2} = ∅ and L_{1} is non-regular | |

L _{1} ∪ L_{2} is not a CFL but L_{2} is | |

There is a 4-state PDA that accepts L _{1}, but there is no DPDA that accepts L_{2} |

**Regular languages and finite automata**

**Context free languages and Push-down automata**

**Gate IT 2008**

**Discuss it**

_{1}and L

_{2}are CFL

B: L

_{1}∩ L

_{2}= ∅ is true

L

_{1}is not regular => true

=> B is true

C: L

_{1}∪ L

_{2}is not a CFL nut L

_{2}is CFL is closed under Union

=> False

D: Both L

_{1}and L

_{2}accepted by DPDA

Question 32 |

{0 ^{n} 10^{2n} | n ≥ 1} | |

{0 ^{i} 10^{j} 10^{k} | i, j, k ≥ 0} ∪ {0^{n} 10^{2n} | n ≥ l} | |

{0 ^{i} 10^{j} | i, j ≥ 0} ∪ {0^{n} 10^{2n} | n ≥ l} | |

The set of all strings over {0, 1} containing at least two 0's | |

None of the above |

**Context free languages and Push-down automata**

**Gate IT 2008**

**Discuss it**

^{i}10

^{j}|i, j ≥ 0} B− > 0B00|1 This production rule individually produces a CFL of the form {0

^{n}10

^{2n}|n ≥ 0} S− > AA|B This production rule concatenates A’s CFL with itself and unions it with B’s CFL. Hence, CFL accepted by the given CFG will be {0

^{n}10

^{2n}|n ≥ 0} ∪ {0

^{i}10

^{j}10

^{k}|i, j, k ≥ 0} According to our derivation, as none of the given CFL matches to our derived CFL, correct option should be (E) None of the above. This solution is contributed by

**vineet purswani**.

Question 33 |

_{1}= {0

^{m}1

^{n}| 0 ≤ m ≤ n ≤ 10000} L

_{2}= {w | w reads the same forward and backward} L

_{3}= {w ∊ {0, 1} * | w contains an even number of 0's and an even number of 1's}

L _{2} and L_{3} only | |

L _{1} and L_{2} only | |

L _{3} only | |

L _{2} only |

**Regular languages and finite automata**

**Gate IT 2008**

**Discuss it**

**vineet purswani**.

Question 34 |

_{1}accepts L

_{1}and M

_{2}accepts L

_{2}.

Which one of the following is TRUE?

L _{1} = L_{2} | |

L _{1} ⊂ L_{2} | |

L _{1} ∩ L_{2}' = ∅ | |

L _{1} ∪ L_{2} ≠ L_{1} |

**Regular languages and finite automata**

**Gate IT 2008**

**Discuss it**

Question 35 |

The combinational circuit generates J and K in terms of x, y and Q.

The Boolean expressions for J and K are :

(x⊕y)'and x'⊕y' | |

(x⊕y)'and x⊕y | |

x⊕y and (x⊕y)' | |

x⊕yand x⊕y |

**Digital Logic & Number representation**

**Gate IT 2008**

**Discuss it**

Question 36 |

ADD (X)−, (X) | |

ADD (X), (X)− | |

ADD −(X), (X)+ | |

ADD −(X), (X)+ |

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

Effective address is the address of the operand. In the given question format is (opcode, source, destination), destination ← source op destination Ex- ADD (X),(Y) -> Source=location X Destination=location Y Operand at Y=operand at X +operand at Y

Here, -X = decrement pointer X and then use the new location pointed by pointer for the operand. +X = increment pointer X and then use the new location pointed by pointer for the operand. X- = decrement pointer X but first use the old location pointed by X. X+ = increment pointer X but first use the old location pointed by X.

Now stack pointer is pointing to X. Say X is 100.

Then,our output should pop the first two elements , i.e. 10 and 5 and put that result in memory location at 99.

**1.**ADD (X)- ,(X) -> Take operand1 as data at memory location X and then decrement X. Operand1 taken as data memory location 100 = 10, X=X-1; X=99; Then take operand 2 as data at memory location new X , Operand2= 5; Now, push back their addition at location X,which is still 99 So, our result is location 99 is filled with 15 which is the desired result.

**2.**ADD (X), (X)− Take operand1 as data at memory location X.Operand1 taken as data memory location 100 = 10, Then take operand 2 as data at memory location X which is still 100, Operand 2= 10; Now, push back their addition at location X,which is 100 So,our result is location 100 is filled with 20 which is not the desired result.

**3.**ADD -(X), (X)+ Decrement and then take operand1 as data at memory location X. So X=99; Operand1 taken as data memory location 99 = 5, Then increment and then take operand 2 as data at memory location X X=X+1; X=100; Operand 2= 10; Now, push back their addition at location X,which is 100 So,our result is location 100 is filled with 15 which is not the desired result.

**4.**ADD -(X), (X) Decrement and then take operand1 as data at memory location X. So X=99; Operand1 taken as data memory location 99 = 5, Then take operand 2 as data at memory location X which is 99 Operand 2= 5; Now, push back their addition at location X,which is 99 So,our result is location 99 is filled with 10 which is not the desired result. This solution is contributed by

**Shashank Shanker khare**.

Question 37 |

125, 7 | |

125, 10 | |

135, 7 | |

135, 10 |

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

=> 140 instructions will take = 14*7 cycles

=> 2

^{m}>=980

=>m>=10 => 10+125 bits and 10 bits

Question 38 |

4.5 | |

4.0 | |

3.33 | |

3.0 |

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

for pipelined system = Max(stage delay)+Max(Latch delay)

=> 2.5+0.5 = 3.0

speedup = time in non-pipelined system/time in pipelined system

= 10/3 = 3.33

Question 39 |

0, 4, 8, 20, 24, 36, 44, 12, 68, 72, 80, 84, 28, 32, 88, 92

How many page faults does this sequence cause? What are the page numbers of the pages present in the main memory at the end of the sequence?

6 and 1, 2, 3, 4 | |

7 and 1, 2, 4, 5 | |

8 and 1, 2, 4, 5 | |

9 and 1, 2, 3, 5 |

**Memory Management**

**Gate IT 2008**

**Discuss it**

Question 40 |

Multiplicand : 0101 1010 1110 1110

Multiplier: 0111 0111 1011 1101

How many additions/Subtractions are required for the multiplication of the above two numbers?

6 | |

8 | |

10 | |

12 |

**Analysis of Algorithms**

**Gate IT 2008**

**Discuss it**

Question 41 |

^{k/2},n

^{k}], for some k>0 which is independent of n, the time taken would be?

Θ(n) | |

Θ(kn) | |

Θ(nlogn) | |

Θ(n ^{2}) |

**Analysis of Algorithms**

**Sorting**

**RadixSort**

**Gate IT 2008**

**Discuss it**

for n keys of word size= w

=>w = log(n

^{k})

O(wn)=O(klogn.n)

=> kO(nlogn)

Question 42 |

^{2k}for some k ≥ 0, the recurrence relation

T(n) = √(2) T(n/2) + √n, T(1) = 1

evaluates to :

√(n) (log n + 1) | |

√(n) (log n ) | |

√(n) log √(n) | |

n log √(n) |

**Analysis of Algorithms (Recurrences)**

**Gate IT 2008**

**Discuss it**

T(n) = √(2) T(n/2) + √n = √(2) [√(2) T(n/4) + √(n/2) ] + √n = 2 T(n/4) + √2 √(n/2) +√n = 2[ √2 T(n/8) + √(n/4) ]+√2 √(n/2)+√n = √(2^3) T(n/8)+ 2 √(n/4) + √2 √(n/2) +√n = √(2^3) T(n/8)+√n +√n +√n = √(2^3) T(n/(2^3))+3√n ............................................. = √(2^k) T(n/(2^k))+k√n = √(2^logn) + logn √n = √n + logn √n = √n(logn +1)

Question 43 |

(a, b), (d, f), (f, c), (g, i), (d, a), (g, h), (c, e), (f, h) | |

(c, e), (c, f), (f, d), (d, a), (a, b), (g, h), (h, f), (g, i) | |

(d, f), (f, c), (d, a), (a, b), (c, e), (f, h), (g, h), (g, i) | |

(h, g), (g, i), (h, f), (f, c), (f, d), (d, a), (a, b), (c, e) |

**Graph**

**Gate IT 2008**

**Discuss it**

Question 44 |

MBCAFHPYK

KAMCBYPFH

MABCKYFPH

Pick the true statement from the following.

I and II are preorder and inorder sequences, respectively | |

I and III are preorder and postorder sequences, respectively | |

II is the inorder sequence, but nothing more can be said about the other two sequences | |

II and III are the preorder and inorder sequences, respectively |

**Binary Trees**

**Tree Traversals**

**Gate IT 2008**

**Discuss it**

II. Pre order

III. Inorder This solution is contributed by

**Pranjul Ahuja.**

Question 45 |

a b e f d g c

a b e f c g d

a d g e b c f

a d b c g e f

A Depth First Search (DFS) is started at node a. The nodes are listed in the order they are first visited. Which all of the above is (are) possible output(s)?

1 and 3 only | |

2 and 3 only | |

2, 3 and 4 only | |

1, 2, and 3 |

**Tree Traversals**

**Gate IT 2008**

**Discuss it**

4: adbc->e or f should be covered

2: abefcgd correct

3: adgebcf correct

Question 46 |

43 36 92 87 11 4 71 13 14

is inserted into an initially empty hash table, the bins of which are indexed from zero to ten. What is the index of the bin into which the last record is inserted?

2 | |

4 | |

6 | |

7 |

**Gate IT 2008**

**Discuss it**

Question 47 |

# include <stdio.h> int main () { char a [6] = "world"; int i, j; for (i = 0, j = 5; i < j; a [i++] = a [j--]); printf ("%s\n", a); } /* Add code here. Remove these lines if not writing code */

dlrow | |

Null String | |

dlrld | |

worow |

**Arrays**

**C Quiz - 113**

**Gate IT 2008**

**Discuss it**

Question 48 |

# include <stdio.h> # define swapl (a, b) tmp = a; a = b; b = tmp void swap2 ( int a, int b) { int tmp; tmp = a; a = b; b = tmp; } void swap3 (int*a, int*b) { int tmp; tmp = *a; *a = *b; *b = tmp; } int main () { int num1 = 5, num2 = 4, tmp; if (num1 < num2) {swap1 (num1, num2);} if (num1 < num2) {swap2 (num1 + 1, num2);} if (num1 > = num2) {swap3 (&num1, &num2);} printf ("%d, %d", num1, num2); } /* Add code here. Remove these lines if not writing code */

5, 5 | |

5, 4 | |

4, 5 | |

4, 4 |

**Pointer Basics**

**C Quiz - 113**

**Gate IT 2008**

**Discuss it**

Question 49 |

#include <stdio.h> int main () { int i, j; int a [8] = {1, 2, 3, 4, 5, 6, 7, 8}; for(i = 0; i < 3; i++) { a[i] = a[i] + 1; i++; } i--; for (j = 7; j > 4; j--) { int i = j/2; a[i] = a[i] - 1; } printf ("%d, %d", i, a[i]); } /* Add code here. Remove these lines if not writing code */

2, 3 | |

2, 4 | |

3, 2 | |

3, 3 |

**Arrays**

**C Quiz - 113**

**Gate IT 2008**

**Discuss it**

there are two variables named: i, with different scope. There are 2 main points to consider while solving this question. Scope of variable i and integer division. First for loop will run for i = 0, 2 and 4 as i is incremented twice inside loop and resultant array will be a = 2, 2, 4, 4, 5, 6, 7, 8 (Loop will terminate at i = 4) After that i value is 3 as there is a decrement operation after for loop. Next for loop is running for j = 7, 6 and 5 and corresponding i values which is a local variable inside for loop will be 3 (7/2), 3 (6/2) and 2 (5/2). Array after this for loop will be a = 2, 2, 3, 2, 5, 6, 7, 8 After the for loop, current i value is 3 and element at a[3] = 2. This solution is contributed by

**Pranjul Ahuja.**

Question 50 |

# include <stdio.h> int main () { int i, j; char a [2] [3] = {{'a', 'b', 'c'}, {'d', 'e', 'f'}}; char b [3] [2]; char *p = *b; for (i = 0; i < 2; i++) { for (j = 0; j < 3; j++) { *(p + 2*j + i) = a [i] [j]; } } } /* Add code here. Remove these lines if not writing code */What should be the contents of the array b at the end of the program?

a b c d e f | |

a d b e c f | |

a c e b d f | |

a e d c b f |

**Arrays**

**C Quiz - 113**

**Gate IT 2008**

**Discuss it**

*(p+2) = a[0][1] *(p+4) = a[0][2] *(p+1) = a[1][0] *(p+3) = a[1][1] *(p+5) = a[1][2]

Question 51 |

```
semaphore S = 1, Q = 0;
integer x;
```

producer: consumer:
while (true) do while (true) do
P(S); P(Q);
x = produce (); consume (x);
V(Q); V(S);
done done
Which of the following is TRUE about the program above?The process can deadlock | |

One of the threads can starve | |

Some of the items produced by the producer may be lost | |

Values generated and stored in 'x' by the producer will always be consumed before the producer can generate a new value |

**Process Management**

**Gate IT 2008**

**Discuss it**

**Solution:**Consumer can consume only once the producer has produced the item, and producer can produce(except the first time) only once the consumer has consumed the item. Let’s explain the working of this code. It is mentioned that Producer and Consumer execute parallely.

**Producer:**st1 - S value is 1, P(S) on S makes it 0 and st2 - and then x item is produced. st3 - Q value is 0. V(Q) on Q makes it 1. this being an infinite while loop should infinitely iterate. In the next iteration of while loop, S is already 0 ,further P(S) on 0 sends P to blocked list of S. So producer is blocked.

**Consumer:**P(Q) on Q makes Q =0 and then consumes the item. V(S) on S, now instead of changing the value of S to 1,consumer wakes up the blocked process on Q 's queue. Hence process P is awaken. P resumes from st2,since it was blocked at statement 1. So P now produces the next item. So consumer consumes an item before producer produces the next item. Correct Option is (D). Choice of this question: A) deadlock cannot happen has both producer and consumer are operating on different semaphores (no hold and wait ) B) No starvation happen because there is alteration between P and Consumer Which also makes them have bounded waiting. (C) Some of the items produced by the producer may be lost but it can’t.

Reference: http://www.geeksforgeeks.org/mutex-vs-semaphore/

This solution is contributed by

**Nitika Bansal**

Question 52 |

Both starvation and deadlock can occur | |

Starvation can occur but deadlock cannot occur | |

Starvation cannot occur but deadlock can occur | |

Neither starvation nor deadlock can occur |

**Process Management**

**Gate IT 2008**

**Discuss it**

Question 53 |

degenerate to shortest job first | |

degenerate to priority scheduling | |

degenerate to first come first serve | |

none of the above |

**Process Management**

**Gate IT 2008**

**Discuss it**

Question 54 |

I-d, II-a, III-b, IV-c | |

I-b, II-c, III-a, IV-d | |

I-c, II-d, III-a, IV-b | |

I-b, II-c, III-d, IV-a |

**Memory Management**

**Gate IT 2008**

**Discuss it**

Question 55 |

- (O1) External inputs and outputs
- (O2) Programming language to be used for the implementation
- (O3) User interactions
- (O4) External interfaces
- (O5) Number of programmers in the software project
- (O6) Files used by the system

O2, O3 | |

O1, O5 | |

O4, O6 | |

O2, O5 |

**Software Engineering**

**Gate IT 2008**

**Discuss it**

Question 56 |

5, 5 | |

4, 5 | |

5, 4 | |

4, 4 |

**Software Engineering**

**Gate IT 2008**

**Discuss it**

Question 57 |

^{-3}and 10

^{-6}, respectively. She decides to implement two classes, Low Precision Matrix and High Precision Matrix, providing precisions 10

^{-}

^{3}and 10

^{-6}respectively. Which one of the following is the best alternative for the implementation?

- (S1) The two classes should be kept independent.
- (S2) Low Precision Matrix should be derived from High Precision Matrix.
- (S3) High Precision Matrix should be derived from Low Precision Matrix.
- (S4) One class should be derived from the other; the hierarchy is immaterial.

S1 | |

S2 | |

S3 | |

S4 |

**Software Engineering**

**Gate IT 2008**

**Discuss it**

Question 58 |

S4 and S3 | |

S4 and S2 | |

S3 and S1 | |

S2 and S1 |

**Software Engineering**

**Gate IT 2008**

**Discuss it**

Question 59 |

A → B, B → C, C → D and D → B. The decomposition of R into (A, B), (B, C), (B, D)

gives a lossless join, and is dependency preserving | |

gives a lossless join, but is not dependency preserving | |

does not give a lossless join, but is dependency preserving | |

does not give a lossless join and is not dependency preserving |

**Gate IT 2008**

**Discuss it**

**Background :**

**Lossless-Join Decomposition:**

Decomposition of R into R1 and R2 is a lossless-join decomposition if at least one of the following functional dependencies are in F+ (Closure of functional dependencies)R1 ∩ R2 → R1 OR R1 ∩ R2 → R2

**Dependency Preserving Decomposition:**

Decomposition of R into R1 and R2 is a dependency preserving decomposition if closure of functional dependencies after decomposition is same as closure of of FDs before decomposition.

A simple way is to just check whether we can derive all the original FDs from the FDs present after decomposition.

**Question :**Let R (A, B, C, D) be a relational schema with the following functional dependencies:

A -> B, B -> C, C -> D and D -> B. The decomposition of R into (A, B), (B, C), (B, D)Note that A, B, C and D are all key attributes. We can derive all attributes from every attribute. Since Intersection of all relations is B and B derives all other attributes, relation is

**lossless**. The relation is

**dependency preserving**as well as all functional dependencies are preserved directly or indirectly. Note that C -> D is also preserved with following two C -> B and B -> D.

Question 60 |

in BCNF | |

in 3NF, but not in BCNF | |

in 2NF, but not in 3NF | |

not in 2NF |

**Database Design(Normal Forms)**

**Gate IT 2008**

**Discuss it**

B->G is partial dependency

So, not in 2NF

Question 61 |

(S1) 2RA 2WA 3RC 2WB 3WA 3WC 1RA 1RB 1WA 1WB

(S2) 3RC 2RA 2WA 2WB 3WA 1RA 1RB 1WA 1WB 3WC

(S3) 2RA 3RC 3WA 2WA 2WB 3WC 1RA 1RB 1WA 1WB

Which of the following statements is TRUE?

S1, S2 and S3 are all conflict equivalent to each other | |

No two of S1, S2 and S3 are conflict equivalent to each other | |

S2 is conflict equivalent to S3, but not to S1 | |

S1 is conflict equivalent to S2, but not to S3 |

**Transactions and concurrency control**

**Gate IT 2008**

**Discuss it**

Question 62 |

^{8}m/s. What should be the packet size for a channel utilization of 25% for a satellite link using go-back-127 sliding window protocol? Assume that the acknowledgment packets are negligible in size and that there are no errors during communication.

120 bytes | |

60 bytes | |

240 bytes | |

90 bytes |

**Data Link Layer**

**Gate IT 2008**

**Discuss it**

Question 63 |

^{8}m/s is

125 bytes | |

250 bytes | |

500 bytes | |

None of these |

**Data Link Layer**

**Misc**

**Gate IT 2008**

**Discuss it**

Question 64 |

_{0}through r

_{3}, and columns d

_{7}through d

_{1}) and is padded with a column d

_{0}and row r

_{4}of parity bits computed using the Even parity scheme. Each bit of column d

_{0}(respectively, row r

_{4}) gives the parity of the corresponding row (respectively, column). These 40 bits are transmitted over the data link.

The table shows data received by a receiver and has n corrupted bits. What is the minimum possible value of n?

1 | |

2 | |

3 | |

4 |

**Data Link Layer**

**Gate IT 2008**

**Discuss it**

=> n=3

Question 65 |

(S1) Count to infinity is a problem only with DV and not LS routing

(S2) In LS, the shortest path algorithm is run only at one node

(S3) In DV, the shortest path algorithm is run only at one node

(S4) DV requires lesser number of network messages than LS

S1, S2 and S4 only | |

S1, S3 and S4 only | |

S2 and S3 only | |

S1 and S4 only |

**Network Layer**

**Gate IT 2008**

**Discuss it**

Question 66 |

(S1) TCP handles both congestion and flow control

(S2) UDP handles congestion but not flow control

(S3) Fast retransmit deals with congestion but not flow control

(S4) Slow start mechanism deals with both congestion and flow control

S1, S2 and S3 only | |

S1 and S3 only | |

S3 and S4 only | |

S1, S3 and S4 only |

**Transport Layer**

**Gate IT 2008**

**Discuss it**

2: No field are there in UDP header to control flow or congestion

3: It is used by TCP to overcome the problem of out of order segments by re-transmission

4: Slow start, nothing to do with flow control

Question 67 |

Which of the following statements are TRUE?

(S1) Loss of SYN + ACK from the server will not establish a connection

(S2) Loss of ACK from the client cannot establish the connection

(S3) The server moves LISTEN → SYN_RCVD → SYN_SENT → ESTABLISHED in the state machine on no packet loss

(S4) The server moves LISTEN → SYN_RCVD → ESTABLISHED in the state machine on no packet loss.

S2 and S3 only | |

S1 and S4 | |

S1 and S3 | |

S2 and S4 |

**Transport Layer**

**Gate IT 2008**

**Discuss it**

**Abhishek Kumar.**

Question 68 |

n(n-1) and 2n | |

2n and ((n(n - 1))/2) | |

((n(n - 1))/2) and 2n | |

((n(n - 1))/2) and n |

**Network Security**

**Gate IT 2008**

**Discuss it**

**Namita Singh.**

Question 69 |

I. 81, 537, 102, 439, 285, 376, 305

II. 52, 97, 121, 195, 242, 381, 472

III. 142, 248, 520, 386, 345, 270, 307

IV. 550, 149, 507, 395, 463, 402, 270

Suppose the BST has been unsuccessfully searched for key 273. Which all of the above sequences list nodes in the order in which we could have encountered them in the search?

II and III only | |

I and III only | |

III and IV only | |

III only |

**Binary Search Trees**

**Gate IT 2008**

**Discuss it**

Key to be searched 273:

- I) 81, 537, 102, 439, 285, 376, 305 is not correct We cannot go to 376 from 285 as 273 is smaller than 285.
- II) 52, 97, 121, 195, 242, 381, 472 is not correct. We cannot go to 472 from 381 as 273 is smaller than 381.
- III) 142, 248, 520, 386, 345, 270, 307 is correct
- 550, 149, 507, 395, 463, 402, 270 is not correct. We cannot go to 463 from 395 in search of 273

Question 70 |

I. 81, 537, 102, 439, 285, 376, 305

II. 52, 97, 121, 195, 242, 381, 472

III. 142, 248, 520, 386, 345, 270, 307

IV. 550, 149, 507, 395, 463, 402, 270

Which of the following statements is TRUE?

I, II and IV are inorder sequences of three different BSTs | |

I is a preorder sequence of some BST with 439 as the root | |

II is an inorder sequence of some BST where 121 is the root and 52 is a leaf | |

IV is a postorder sequence of some BST with 149 as the root |

**Binary Search Trees**

**Gate IT 2008**

**Discuss it**

B: If 439 is root, It should be 1st element in preorder

D: IV is a postorder sequence of some BST with 149 as the root, => False

Question 71 |

4 | |

5 | |

6 | |

9 |

**Binary Search Trees**

**Gate IT 2008**

**Discuss it**

^{2n}C

_{n}/(n+1) =

^{6}C

_{3}/4 = 5

Question 72 |

School (school-id, sch-name, sch-address, sch-phone)

Enrolment(school-id sch-roll-no, erollno, examname)

ExamResult(erollno, examname, marks)

What does the following SQL query output?

SELECT sch-name, COUNT (*) FROM School C, Enrolment E, ExamResult R WHERE E.school-id = C.school-id AND E.examname = R.examname AND E.erollno = R.erollno AND R.marks = 100 AND S.school-id IN (SELECT school-id FROM student GROUP BY school-id HAVING COUNT (*) > 200) GROUP By school-id /* Add code here. Remove these lines if not writing code */

for each school with more than 200 students appearing in exams, the name of the school and the number of 100s scored by its students | |

for each school with more than 200 students in it, the name of the school and the number of 100s scored by its students | |

for each school with more than 200 students in it, the name of the school and the number of its students scoring 100 in at least one exam | |

nothing; the query has a syntax error |

**SQL**

**Gate IT 2008**

**Discuss it**

Question 73 |

_{1}, n

_{2}and n

_{3}nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbors.

n

_{3}can be expressed as

n _{1} + n_{2} - 1 | |

n _{1} - 2 | |

[((n _{1} + n_{2})/2)] | |

n _{2} - 1 |

**Binary Trees**

**Gate IT 2008**

**Discuss it**

Question 74 |

_{1}, n

_{2}and n

_{3}nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbors.

Starting with the above tree, while there remains a node v of degree two in the tree, add an edge between the two neighbors of v and then remove v from the tree. How many edges will remain at the end of the process?

2 * n _{1} - 3 | |

n _{2} + 2 * n_{1} - 2 | |

n _{3} - n_{2} | |

n _{2} + n_{1} - 2 |

**Binary Trees**

**Gate IT 2008**

**Discuss it**

Question 75 |

S→aS∣A

A→aAb∣bAa∣ϵ

Which of the following strings is generated by the grammar above?

aabbaba | |

aabaaba | |

abababb | |

aabbaab |

**Context free languages and Push-down automata**

**Gate IT 2008**

**Discuss it**

Question 76 |

S→aS∣A

A→aAb∣bAa∣ϵ

For the correct answer in Q75, how many steps are required to derive the string and how many parse trees are there?

6 and 1 | |

6 and 2 | |

7 and 2 | |

4 and 2 |

**Context free languages and Push-down automata**

**Parsing and Syntax directed translation**

**Gate IT 2008**

**Discuss it**

Question 77 |

7, 6, 7 | |

8, 5, 7 | |

8, 6, 6 | |

9, 4, 7 |

**Memory Management**

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

**Namita Singh**.

Question 78 |

000011000 | |

110001111 | |

00011000 | |

110010101 |

**Memory Management**

**Computer Organization and Architecture**

**Gate IT 2008**

**Discuss it**

**Namita Singh**.

Question 79 |

void f (int n) { if (n <=1) { printf ("%d", n); } else { f (n/2); printf ("%d", n%2); } }What does f(173) print?

010110101 | |

010101101 | |

10110101 | |

10101101 |

**Recursion**

**C Quiz - 112**

**Gate IT 2008**

**Discuss it**

_{2}= 10101101

Question 80 |

void f (int n) { if (n <= 1) { printf ("%d", n); } else { f (n/2); printf ("%d", n%2); } }Which of the following implementations will produce the same output for f(173) as the above code? P1

void f (int n) { if (n/2) { f(n/2); } printf ("%d", n%2); }P2

void f (int n) { if (n <=1) { printf ("%d", n); } else { printf ("%d", n%2); f (n/2); } }

Both P1 and P2 | |

P2 only | |

P1 only | |

Neither P1 nor P2 |

**Recursion**

**C Quiz - 112**

**Gate IT 2008**

**Discuss it**

**Anil Saikrishna Devarasetty**.

Question 81 |

Given the information above, how many distinct subnets are guaranteed to already exist in the network?

1 | |

2 | |

3 | |

6 |

**Network Layer**

**IP Addressing**

**Gate IT 2008**

**Discuss it**

default Mask for class C = 24

Here given mask is 11 bits ( 11111111 11111111 11111111 11100000)

subnet ID: 3 bits

existing subnets: 011, 010 and 100

Question 82 |

Which IP address should X configure its gateway as?

192.168.1.67 | |

192.168.1.110 | |

192.168.1.135 | |

192.168.1.155 |

**IP Addressing**

**Gate IT 2008**

**Discuss it**

For network address keep Network bits as it is and put host bits =0 in any given IP address.

Network address = 192.168.1.01100000 =>192.168.1.96

For: 192.168.1.97/28

Network address = 192.168.1.01100000 =>192.168.1.96