Sei sulla pagina 1di 17

GATE 2012 Set D

Now this is a very easy question but there is a chance to be mistaken. An average student knows the protocols but is it necessary that hed be able to answer the question?

The first thing which is usually noticed.

Electronic mail? Then its definitely SMTP.

But we missed transport layer protocol. So there are two transport layer protocols, TCP and UDP. I hope you know whats the answer. Its TCP. SMTP is at application layer.

To be very frank, I revised the question paper twice, but I thought to give priority to other questions so I didnt notice that I have marked the wrong answer.

GATE 2012 Set D

You can create (or just imagine) the graph.

F(x=-1) = 0.5
+0.5

+
-
-1 +1 -0.5

F(x=1) = 0.5 + 0.5 = 1

I think Clearly Now So we this this can given graph can mark f(-1) be is these. called done = f(+1) in probability = your 0.5 head distribution too and should function not take . Itmore represents than 15 distribution seconds. of But to probability. be on a safer f(-1) side, means write-1 it can down appear so that with itll a become chanceeasier of 0.5.when you revise the question later. Also sum of probability will always be 1 as clearly be seen. I excluded the boundary value because I was confused whether F(x=1) equals f(x<=1) or f(x<1). I marked the wrong answer. F(x=1) is the sum of all the probabilities before and at 1. Cumulative distribution function F(-) = 0 and F(+) = 1. You can now calculate the correct answer easily. You see things get easier when you can represent them graphically.

GATE 2012 Set D

This is W(n) not ato difficult question. Everyone knows just on the So for be the worst case and A(n) to be the the concept. average,We A(n) <= need W(n) to or concentrate A(n) = O(W(n)). options. Option D A(n) = o(W(n)) also looks promising but the worst case can sometimes be equal to If I say A(n) = (W(n)), then it means A(n)/W(n) >= R as n. Or A(n) is asymptotically larger A(n) as well. So we cant bound it strictly. than equal to W(n). Remember the word asymptotically is very important because we are considering the values at n.
Well try to represent these stuff graphically.

Notice that the value of A(n)/W(n) can be either 0, R (a positive real number) or . Small Theta Big BigOmega O o notation notation notation notation Small omega notation If its 0, then A(n)<W(n); A(n) A(n) = = o(W(n)); O(W(n)); (W(n)); (W(n)); A(n) = w(W(n)); R then A(n)=W(n); A(n)/W(n) A(n)/W(n) = >= <= 0; R; R R(R (0 or or ); R); A(n)/W(n) = ; then A(n)>W(n) A(n) A(n) < = >= <= W(n) W(n) W(n) A(n) > W(n) asymptotically.
Use left/right arrow to scroll through all the cases.

0
A(n) < W(n)

Real number R
A(n) = W(n)

A(n) > W(n)

GATE 2012 Set D

First Many BUT of HOW? might all if you have dont memorized know what its equation is Towers and of Hanoi know that problem, the answer then better is D. check it on wikipedia.

SOMEHOW!!

SOMEHOW!!

nd tower using rd one. Let there be nmove discsn-1 anddiscs T(n) to bethe the2 complexity to move to the 3rd tower using the 1. Somehow, the 3them 2nd one. It will take T(n-1) complexity. It involves 3 steps. 2. Move the largest disc in the 1st tower to the 3rd one. It will take constant complexity (ie O(1)) because it does not depend on the number of discs.

3. Move those n-1 discs in the 2nd tower to the 3rd one using the 1st one. It will again take T(n-1) complexity. So T(n) = 2T(n-1) + 1.

GATE 2012 Set D

In this one,to we have to select one statement from P and Q and one from R and S. According this, option B is correct. But I marked D. Earlier I thought that clause appear only with GROUP BY. I thought Q is true. But its not In the gateforum key,HAVING its A. And in thecan original key, its C. the case. Later, I ran the query containing HAVING clause without GROUP BY. It ran. It creates a I left it group up to you to decide. Let rows. me know if is Im wrong somewhere. single which has all the So P true. Also not all the attributes in the in the GROUP BY needs to be present in the SELECT. I have tested the following query to be true many times. select name from students group by name, date This makes S true.

GATE 2012 Set D

The complement automata accepts is this a+. If you dont understand how, just click this.
a

Clearly, the language Complement of a+ is an accepted empty string by this ie. is . a*So, . the correct answer is B. My blunder: The problem is I knew switching that toggling between the final final and and non-final non-final states states gives of an complement automata complements of a languageit. accepted only by DFA. NDFAs are not closed under complentation; DFAs are. I didnt know that. Blindly, I marked C and got a 2-mark question wrong. Dont just rely on properties, understand the concept.

GATE 2012 Set D

A fork command splits athat process into two. Then both processes start executing simultaneously from Clearly, we can deduce n fork() statements statement will have 1; 2n processes. the the fork() command. So answer should be 8. statement 2; We the following But will onetake of them is parent,program. so 7 child processes are present. Answer C is correct. fork(); Even if it was marked in bold that they were asking the number of child processes, I marked statement 1; D. Clearly, its a lack of concentration because of anxiety in the exam. Just try to avoid such statement 2; mistakes. fork(); statement 3; statement 3; statement 3; fork(); statement 4; statement 4;
Process 1

fork(); statement 4;
Process 2

fork(); statement 4;
Process 3

statement 4;
Process 4

GATE 2012 Set D


You can check the options in the question paper Ive uploaded.
0 1

? ?
1

There is a key statement which says every substring of 3 symbols has at most two zeros. That is, 3 consecutive zeros are not possible.
?

We know that every state should have a transition on all the alphabets (ie 0 and 1). So to find the missing arcs, we will find the states not having transition on these two alphabets.
?

Notice that we have a dead state (q). Once that is reached, the string can never be accepted

Also notice that the state names are the last two digits which have been parsed. For example, 001110 will lead to state (10), 011001 to state (01). Dont click before you try to solve the question. The missing transitions are marked. Find the corresponding states after considering the above points. Try to do it in your head.

GATE 2012 Set D


We know that every state should have a transition on all the alphabets (ie 0 and 1). So to find the missing arcs, we will find the states not having transition on these two alphabets.

0 0

(00) is a state without any transition. The string parsed up to this state ends with 00.
1 0

On transition at 1, it will end at 001, thus leading to state (01). On transition at 0, it will end at 000. But this doesnt lead to (00) because it is an invalid string now. So, we will direct it to the dead state (q).

(11) is another state with missing transition. The string ends with 11 here. On transition at 0, it will end with 110, thus leading to state (10). Similarly, (01) at transition 1 will lead to (11) and (10) at transition 0 will lead to (00). I think its safe to choose option D now.

GATE 2012 Set D


Usually candidates have a tendency to leave such questions thinking Its a complex one; well come back to it later. And the easy question might go unnoticed. Just look at the options before doing that. They have already solved most of the problem. All we have to do is to recognize whether to include +1 or not.

Well consider for Box B2 B1 now. first.


left != = null; null;right right!= !=null null
height(n) +1 h1 = height(n->left) null

+1
height(n->right)

subtree

subtree

h1 Can Its clear stores you tell the now the height tree that should left B1: subtree be (1+height(n->right)) and h2 the height of Yes, wefrom have to.what Soof answer A is B1? correct right subtree. We have to take whichever is maximum. Anyways, this is clear from the options. But can you tell from the tree whether to include +1 or not?

GATE 2012 Set D

B(r1) is equivalent to select distinct B from r1

Two tables are there. B is a foreign key which refers to C in R2.

Cbut face D different problems. Everyone knows that every Sometimes candidates know all these things Try taking some r1 examples if you still have problem. value of B must be in C but they might not understand that the question is testing the same thing. So, r2 Possible values of be B= {1, 2, 3} this. Its you who have to do some effort. avoid stress.distinct The question can not simpler than Possible distinct values of have C = simple {1, 2, 3 more} Usually complex looking problems Now, what referential integrity means? It meanssolutions. that if B has a value referring to C, then C must also Obviously, B C = . Option A is correct. have that value; otherwise it is a violation. It is obvious; isnt it? So every value in B is in C as well.
So option A is true.

GATE 2012 Set D

It all depends how we merge the two halves. It takes O(n) element comparisons which needs So Gateforum you seesolution that they stated always that open the up height the concept. of the tree If wed is logn just and memorize n2 comparisons the complexities, are done we at each would 2 O(1) time each. But in case ofunderstand strings, each comparison takes O(n); so the total merging level; never be complexity able to dig is into O(n it. So logn) hence B.things The statement clearly. is not have wrong. they Im derived still confused the recursion with this If itd so have been just integers, then everyone knows thatHow the answer would have been O(nlogn) . 2 complexity is original O(n ). key question. formulae? T(n) =strings 2T(n/2) +also O(n) states nwhy marks is a=2 to in all merge for this sortone. but not If an in algorithm quick sort? is Compare O(n2logn), things then it is But whatThe about of length ? To solve this, we need to have clear understanding of merge 2 O(n best, average Im not clear and about cases the worst EVERYTHING. case. According Its a toone me time it should effort. be Just D. dig yourself into the core. sort. The). equation thusworst becomes Anyways, now think if2) youd have known the approach, itd hardly have taken 60 seconds. T(n) = 2T(n/2) + O(n Merge sort splits the list into halves, sorts them and the merges them. The complexity to merge It can easily solved Masters Theorem 3rd case. So answer is D. those halvesbe is O(n) in using case of integers. Click here if you have any difficulty in applying Masters theorem.
T(n)

UNSORTED LIST
T(n/2) Split into halves T(n/2)

Sort them Merge them: Takes O(n/2) or simply O(n) T(n) = 2T(n/2) + O(n)

SORTED LIST

GATE 2012 Set D

Graphically, the question can be seen as follows (if the of1s. theSo, function is {0,1}) Everyone knows that there can be 2n combinations of nrange 0s and the answer can be A. But notice that it is asking for onto functions only, ie every function should cover both the values for atleast one input. Therefore, there cannot be all 0s (000000) and all 1s (111111). After removing these values, thea1 answer comes out to be C. a2 (100001) (000011) (000001) (000000) a3 0 a4 1 This is not a loophole to fall into, a5 but I marked the wrong answer (A). My tension blinded me. . . an

Now for every value ax, the function can have value either 0 or 1. So to create a function, we just have to create a combination of n values.

GATE 2012 Set D

Now, notice Now ask yourself: here that Was forthis positive question weights, so difficult? the spanning Do you tree really would need always a penbe paper the same. to solve For this example one? while If you using think yourself Kruskals qualified algorithm, enough if we to select get into edge IITs, AB then (6) in you G, should then it will be able select tothe solve same thisedge in your AB (36) in G` as well. head. No matter So, option how much C is not time possible. you take while practising such questions, but gradually make your mind sharper. Try to remember graphs and maps, move values here and there etc in your mind. After 2 + need 2 2) <level sometime, you wont take muchto time. You one wont feel the use this Now the question is analogous the this : Is (a1 a22 + to a32 + apen an (a1 +of a2question. + a3 + a4 4 in 2 an) ? Here a1 to an are the weights of the edges of the MST. We know is. So I marked B inwrite the exam. But duringthat the it exam (even mocks), down things to avoid such mistakes; so that when you come again, you know what you thought before. Its like loading the graph in your head again. Usually, we have But if there is only one edge inof the graph (n=1), While then LHS = RHS which makes A true asthat well. None of a tendency not to mark none these option. marking it, we have to make sure the other the option isfalse. fully correct. The answer isoption D then. options are If we find some other a bit satisfying, we go for that. Thats what I did at that G1 makes B false and G2 makes A false. time. I grabbed the question correctly, created an analogous problem but considered only the general case. I didnt think that there can be a graph with a single edge.
1 Remember to make 2 special cases at special values of n (like 0, 1, 2 ) or at values where some expression is getting G1a special value (eg n=4 in n-4). 5 G2 9 6

GATE 2012 Set D


For this one, if you dont know what are isomorphic graphs, then first read it here. If you can rearrange the vertices of first graph to form the second one, then the two graphs are isomorphic. Try doing the following question in your head in 15 seconds. Even this time is more than enough.

Though The answer it is an B is easy correct. question, If you but areit still becomes not able difficult to do it, to think trust hard your mind and keep orally. trying. Dont Not I need all great to people write down are genius. something? They What just stick would with you the write? problems Would a you bit longer label the than vertices others.and It doesnt check matter one by even if one? Rather it takes Idasuggest day. Once to make you are your done, mind the sharper next time so that youll you take can less trust time. it. After solving, read the question again and then solve. Youll understand the difference between the way you thought earlier and you shouldve thought. Your mind is learning. You can notice that you just need to find the one having a pentagon. You are left with option B and C. Next, one point in that pentagon is having 2 tentacles. So, clearly B is correct.

GATE 2012 Set D

1
a

Which language does it accepts? Starting from the starting state, we need to find all the paths which lead us to the final state.

String a aa

States it gone through 12 12312

So it accepts the strings {a, aa, aaa, } Notice that it does not accept null string. You can not reach state 2 without atleast 1 a.

Return back

GATE 2012 Set D


Masters theorem
It is used to solve a recurrence relation of the form. T(n) = aT(n/b) + f(n) Here f(n) = (nc) We first compare the order of f(n) ie c with logba

Case 1: If c < logba T(n) = (n


logba

Case 2: If c = logba T(n) = (nclogn) Case 3: If c > logba T(n) = (nc)


So you can see that T(n) is either (nc) or

(n

logba

) whichever is greater. And if they

are equal, T(n) = (nclogba). Its easy to remember.

Return back

Potrebbero piacerti anche