# GATE CS 2013

 Question 1
A binary operation on a set of integers is defined as x y = x2 + y2. Which one of the following statements is TRUE about ?
 A Commutative but not associative B Both commutative and associative C Associative but not commutative D Neither commutative nor associative
GATE CS 2013    Set Theory & Algebra
Discuss it

Question 1 Explanation:
Associativity: A binary operation ∗ on a set S is said to be associative if it satisfies the associative law: a ∗ (b ∗c) = (a ∗b) ∗c for all a, b, c ∈S. Commutativity: A binary operation ∗ on a set S is said to be commutative if it satisfies the condition: a ∗b=b ∗a for all a, b, ∈S. In this case, the order in which elements are combined does not matter. Solution: Here a binary operation on a set of integers is defined as x⊕ y = x2 + y2. for Commutativity: x ⊕y= y ⊕x. LHS=> x ⊕y= x^2+ y^2 RHS=> y ⊕x= y^2+x^2 LHS = RHS. hence commutative. for Associativity: x ⊕ (y ⊕ z) =(x ⊕ y) ⊕ z LHS=> x ⊕ (y⊕ z) = x ⊕ ( y^2+z^2)= x^2+(y^2+z^2)^2 RHS=> (x ⊕y) ⊕z= ( x^2+y^2) ⊕z=(x^2+y^2)^2+z^2 So, LHS ≠ RHS, hence not associative. Reference: http://faculty.atu.edu/mfinan/4033/absalg3.pdf This solution is contributed by Nitika Bansal Another Solution : [Tex]\oplus[/Tex] commutative as x[Tex]\oplus[/Tex]y is always same as y[Tex]\oplus[/Tex]x. [Tex]\oplus[/Tex] is not associative as (x[Tex]\oplus[/Tex]y)[Tex]\oplus[/Tex]z is (x^2 + y^2)^2 + z^2, but x[Tex]\oplus[/Tex](y[Tex]\oplus[/Tex]z) is x^2 + (y^2 + z^2)^2.
 Question 2
Suppose p is the number of cars per minute passing through a certain road junction between 5 PM and 6 PM, and p has a Poisson distribution with mean 3. What is the probability of observing fewer than 3 cars during any given minute in this interval?
 A 8 / (2e3) B 9 / (2e3) C 17 / (2e3) D 26 / (2e3)
GATE CS 2013    Probability
Discuss it

Question 2 Explanation:
See http://en.wikipedia.org/wiki/Poisson_distribution#Definition
PR(X < 3) = Pr(x = 0) + Pr(x = 1) + Pr(x = 2) = f(0, 3) + f(1, 3) + f(2, 3) Put [Tex]\lambda[/Tex] = 3 and k = 0, 1, 2 in the formula given at http://en.wikipedia.org/wiki/Poisson_distribution#Definition = 17 / (2e3)
 Question 3
Which one of the following does NOT equal to
 A A B B C C D D
GATE CS 2013    Linear Algebra
Discuss it

Question 3 Explanation:

First of all, you should know the basic properties of determinants before approaching For these kind of problems. 1) Applying any row or column transformation does not change the determinant 2) If you interchange any two rows, sign of the determinant will change

A = | 1 x x^2 | | 1 y y^2 | | 1 z z^2 |

To prove option (b)

=> Apply column transformation C2 -> C2+C1

C3 -> C3+C1

=> det(A) = | 1 x+1 x^2+1 | | 1 y+1 y^2+1 | | 1 z+1 z^2+1 |

To prove option (c),

=> Apply row transformations R1 -> R1-R2

R2 -> R2-R3

=> det(A) = | 0 x-y x^2-y^2 | | 0 y-z y^2-z^2 | | 1 z z^2 |

To prove option (d),

=> Apply row transformations R1 -> R1+R2

R2 -> R2+R3

=> det(A) = | 2 x+y x^2+y^2 | | 2 y+z y^2+z^2 | | 1 z z^2 |

This solution is contributed by Anil Saikrishna Devarasetty .

 Question 4
The smallest integer that can be represented by an 8-bit number in 2’s complement form is
 A -256 B -128 C -127 D 0
GATE CS 2013    Number Representation
Discuss it

Question 4 Explanation:
See Two's complement For n bit 2's complement numbers, range of number is -(2(n-1)) to +(2(n-1)-1)
 Question 5
In the following truth table, V = 1 if and only if the input is valid. What function does the truth table represent?
 A Priority encoder B Decoder C Multiplexer D Demultiplexer
GATE CS 2013    Digital Logic & Number representation
Discuss it

Question 5 Explanation:
Since there are more than one outputs and number of outputs is less than inputs, it is a Priority encoder V=1 when input is valid and for priority encoder it checks first high bit encountered. Except all are having at least one bit high and ‘x’ represents the “don’t care” as we have found a high bit already. So answer is (A).
 Question 6
Which one of the following is the tightest upper bound that represents the number of swaps required to sort n numbers using selection sort?
 A O(log n) B O(n) C O(nLogn) D O(n^2)
GATE CS 2013
Discuss it

Question 6 Explanation:
To sort elements in increasing order, selection sort always picks the maximum element from remaining unsorted array and swaps it with the last element in the remaining array. So the number of swaps, it makes in n-1 which is O(n)
 Question 7
Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?
 A O(1) B O(Logn) C O(n) D O(nLogn)
GATE CS 2013
Discuss it

Question 7 Explanation:
To insert an element, we need to search for its place first. The search operation may take O(n) for a skewed tree like following.
To insert 50, we will have to traverse all nodes.
10
\
20
\
30
\
40

 Question 8
Consider the languages L1 = and L2 = {a}. Which one of the following represents L1 L2* U L1*
 A A B B C C D D
GATE CS 2013    Regular languages and finite automata
Discuss it

Question 8 Explanation:
L1 L2* U L1* Result of L1 L2* is [Tex]\phi[/Tex]. {[Tex]\phi[/Tex]} indicates an empty language. Concatenation of [Tex]\phi[/Tex] with any other language is [Tex]\phi[/Tex]. It works as 0 in multiplication. L1* = [Tex]\phi[/Tex]* which is {[Tex]\epsilon[/Tex]}. Union of [Tex]\phi[/Tex] and {[Tex]\epsilon[/Tex]} is {[Tex]\epsilon[/Tex]}
 Question 9
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A -> є and A -> a) to parse a string with n tokens?
 A n/2 B n-1 C 2n-1 D 2n
GATE CS 2013    Parsing and Syntax directed translation
Discuss it

Question 9 Explanation:
Given in the question, a grammar with no epsilon- and unit-production (i.e., of type A -> є and A -> a) . Suppose the string is abcd. ( n = 4 ) We can write the grammar which accepts this string as follows:

S->aB
B->bC
C->cd 
The Right Most Derivation for the above is:

S -> aB ( Reduction 3 )
-> abC ( Reduction 2 )
-> abcd ( Reduction 1 )
We can see here that no production is for unit or epsilon. Hence 3 reductions here. We can get less number of reductions with some other grammar which also does't produce unit or epsilon productions,

S->abA
A-> cd
The Right Most Derivation for the above as:

S -> abA ( Reduction 2 )
-> abcd ( Reduction 1 )
Hence 2 reductions. But we are interested in knowing the maximum number of reductions which comes from the 1st grammar. Hence total 3 reductions as maximum, which is ( n - 1) as n = 4 here. Thus, Option B.
 Question 10
A scheduling algorithm assigns priority proportional to the waiting time of a process. Every process starts with priority zero (the lowest priority). The scheduler re-evaluates the process priorities every T time units and decides the next process to schedule. Which one of the following is TRUE if the processes have no I/O operations and all arrive at time zero?
 A This algorithm is equivalent to the first-come-first-serve algorithm B This algorithm is equivalent to the round-robin algorithm. C This algorithm is equivalent to the shortest-job-first algorithm.. D This algorithm is equivalent to the shortest-remaining-time-first algorithm
GATE CS 2013    CPU Scheduling
Discuss it

Question 10 Explanation:
The scheduling algorithm works as round robin with quantum time equals to T. After a process's turn comes and it has executed for T units, its waiting time becomes least and its turn comes again after every other process has got the token for T units.
There are 65 questions to complete.