You are on page 1of 14
Solved Paper 2016 GATE Computer Science and IT Time: 3 hrs MM : 100 Read the following instructions carefully 5. There are 65 questions carrying 100 marks of 3 hs duration inthis paper. 2. Questions 1 o25canry questions 261055 cary 2marks each 3. Queslions 561065 belong to General Aptitude (GA) Type. Questions 56 1060 cary 1 mark each and questions 61 1065 carry 2markseach markeas 4, Unatterpted questions willcary zero marks. 5. For questions 1 {025 and 56 to 60, 1/3 mark willbe deducted for each wrong answer. For questions 26 0 65 and 6! 1065, 2/3 ‘markwille deducted for each wrong answer. 5. Thoreisno negative marking for rumericalanswer ype questions, 7 Physical calculator, chars, graph sheets and mathematical tables arenotallowedin the examnnationball (1 Mark Questions) 1. Let p, 45 represent the following propositions. Sol. (b) The least value of » for the recursion wouls psx €48,9,10,1112) 43x a composite number reais a perfect square sx isa prime number Fora 010, 100, 19 For n= 4, number of stings = 8 (0000, 0001, (0010, 0100, 1000, 0101, 1910, 1001 n=1, number of stings =2 (0,1) Forn =2, number of stings =3 (00, 01, 10) umber of stings = 5 (000, 001, The integer x22 which satisfies — (ip = g) tary 9) Is Sol. (11) (0 4) will gve (8, 9, 1, 12} me nll give (8, 10,11, 12} This seems to folow Ficonacci series and the +s wil give (8, 8,10, 12} 18 relation for iis (ry =) wil give (8, 8, 10,11, 12) 8 Baths (pa) Ory 75) will ve (8, 9, 10, 12} oq) (oF 8) ill give 11 hus, answer is 11 Sol. (1) Pury=x=4 2. Leta, be the number of m-bit stings that do not contain two So. the pratlem becomes consecutive 1's. Which one of the following is the recurrence . relation for 2,? lim fs yl y= (3) 55 = 4,2 4 ay (0) ay = p21 tga {Property ofits sr) (a= 2 +aycy (0) a, = 2a, + eg Thus, 1s the answer 2 Sol. (05) Given, Solved Paper : Computer Science and IT 4. A probability density function on the interval [2,1] is, given by 1/x* and outside this interval the value of the function is zero, The value of a is 2 charts roa 80 i foxj=t 5. Two eigenvalues of a 3%3 real matrix P are @ + W=I) and 3. The determinant of P is Sol. (16) The determinant of a real mati ean never be imaginary. So, fone eigen value is complex, the ther eigen value has to be ts conjugate So, the eigen values ofthe matix will be2+i, 2—i and 3. ‘Also, determinant is the product of all eigen values: =@4N2-18= 18 6. Consider the Boolean operator # with the following properties. x#0= x, x# 12%, x# x0 and x# XL Then, x# y is equivalent to (ay aF+ Ry (by 5+ (ive (ay ay +55 Sol. (a) x # 0= x 1 x12 2 xex=0 3 xeR=1 4 ayaa Ry xy | ey oof oe oo4 1 10 1 1 o ‘The 16-bit 2's complement representation of an integer is LIT 1111 1111 0101; its decimal representation is Sob. (6) 11) B111 11111111 0101 € Gian pumber in No. is ve 25 complement form 8000 0000 0900 1011 «2's ofthe number Decimal equivalent is 11 8. We want to design asynchronous counter that counts the sequence 0-1-0-2.0-3 and then repeats. The minimum number of J-K flip-flops required to implement this counter is Sol. (4) We need four JK fig-tops 0-9 1-90-92-90-93, (0000-> 0001 > 0100-» 0010-> 1000-» 0017 ‘There are 6 states and 3 of them correscond to same slate to diferentate between 0, 1, 2, 3 we need 2 bits. To difereniate between 3, O'S we need 2 bis 0, folal 4 bis=2 FE 9. A processor can support a maximum memory of 4 GB, where the memory is word-addressable (a word consists of two bytes). The size of the address bus of the processor is at least bits, Sol. (31) Maximum memory = 4 G8 =2" bytes, Size of a word = 2 bytes Thotefor, number of words =2 /2 =2%" So, we requie 31 bils for the address bus of the processor, 10. A queue is implemented using an array such that ENQUEUE and —DEQUEUE operations are performed efficiently. Which one of the following, statements is correct (1 refers to the number of items in the queue)? {a} Both operations can be performed in Of) time (b) At most one operation can be performed in 04) time but the worst case time for the other ‘operation will be © () (6) The worst ease time complexity for both operations will be 2 (dl) Worst case time complexity for both operations will ‘be 2 (log n) Sol. (a) Implementing queue using aay ENQUEUE Operation ‘Check array full or nt if array is ful stop ‘alse enter the element in the end of aay; which wil take (1) time, DEQUEUE Operation Check array empty or not if aray is empty stop else delete the element trom front of array and increment the head vakie (pointer to the stating clement of array) which wil ake Of") time, So for array implementaion of queue, ENQUEUE and DEQUEUE operation takes 0) time. 11. Consider the following directed grapit ow ‘The number of different topological orderings of the vertices of the graph is Sol. (6) Following ate diferent 6 topological sortings abcoe! adebet abdcel adbcel abdec! adbect 12, Consider the following C program. void FCint, short) void main() ‘ int 1 = 100; shart s = 12 ts 2 feat to FO short *p Which one of the following expressions, when placed in the blank above, will not result in a type checking ‘error? fa) f(s.%8) (bye fois) cathe tastiepd Sol. (3) £(5,"} since there is no pointer variable define vith *s So, tis function wil iva type checking errr. 4,8) since function prototype is void in void fit, short) Le. '§ accopting argument int typo and short ‘ype and its retum type shouki be integer because we ore the output of function in varable i whichis integer ‘ype. So there must be type casting into integer type but type casting isnot present. 13. Sol. 14. Sol. 15. GATE 2016 | 3 $0, his function wil give type checking error. {{j,*8) since there 's no pointer variable define wih *s. So, this function wil ve type checking error. {ij,*p)in ths function to argument are pass one 's int ype and anther Is short type defined in the main function. So this function will not give type checking enor ‘The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are (2) © (10g m,n 1og and ©") (0) 8.07), ir?) and @ og n) {€) ©"), 0 (0g n) and (2 log m) (4) 8 071,808 log m) and © or) (@) The worst case ime complexity of also given are Inserion sort = 6 (0?) Merge sort =@ (log n) Quick sor =0 (0?) Let, G be a weighted connected undirected graph with distinct positive edge weights. If every edge ‘weight is increased by the same value, then wiich of the following statements is/are true? P : Minimum spanning tree of G does not change (Q: Shortest path between any pair of vertices does ‘not change (a) only P (c) Neither P nor Q (b) Only Q (4) Both P and Q (a) The shortest path may change. The reason is there may be ciferent number of edges in cferent paths from s to |. For example, let shortest path be of weight 18 and has 5 edges. Let there be another path with 2 edges and total weight 25. The weight of the shortest path is increased by 5* 10 and becomes 154-20. Woight of the cothor path is increasod by 2* 10 and becomes 25 ~ 20. So, the shortest path changes to the other path with weight as 45, The minimum spanning tte does not change. Remember the Kruskals algorithm where we sort the edges first. H we increase all weights, then order of ledges won't change. Consider the following € program. Hincludecstaie.h> void mystery(int *ptra, int *ptra) int *temp: temp = ptr ptrb = ptra: ptra ~ temp 4 | Solved Paper : Computer Science and IT int main( ‘ int aH2016, b0, cf, d= 42; ystery(ta, &b) iflase) nystery(4e, fa): nystery(ha, &d) printf("%éln", ads , ‘The output of the program is Sol. (2016) a GIGS “Myr (a, en fan's panned “ptra = Ga; *pirb= &b Toor “20003000 rb; tomy tomy pirb =ptra; = ptr =100/" * pira =tomp: = tra =200) #278 2, W018 <4) false So, mystery, 8) =f stfect on variables sprasda "prb=de; ova pre temp 00 Toor 2000» _S000 temp =ptr b; =+temp cl silect on vaiables Print('a"); 2016 Output 2016 16. Which of the following languages is generated by the given grammar? S>as|psle (a) 2°8" [n,m2}0 (b) (w ©(@, 8} has equal number of a's and b's} (c) {a [2 0) {B" | 0} (aH | 20} (aya Sol. (¢) We can generate, a, ab, abb, b, aaa, 17. Which of the following uundecidable? 1. Given NFAS Ny, and N,, is LIV) A LWN3)=® IL, Given a CG G =(N,E, P,9) and a string xe E*, does xe LG? jon problems are I, Given CFGsG, and G,, is L(G, IV. Given, a TM M, is L(4)= 6? (a)Tand1V (b) Tand (c) Mand v (a) Wand ‘Sol. (c) A problom is undocidable if there is no algorithm to find the solution for it. Problem gye in Il and MV have ro solutions, so these are undecidable UG,? 18. Which one of the following regular expressions represents the language : the set of all binary strings having two consecutive 0s and two consecutive 1s? (a) (0+ 1)*0011(0-+1)* + (0+ 1)*1200(0+ 1)* (b) (042) *(0010 +1) 11 +110 1) +00) (0-41) * fe} (041 *00(0.4)* + (0+ 711004) * (4) 00(0-+ 711 +11(041)*00 (©) Option A represenis those stings which ether have (0011 oF 1100 as substring. Option C represents those stings which either have 00 or 11 as supsting, Option D represents those stings which start with 11 ‘and ena with 00 or stat with 09 and end with 11 19. Consider the following code segment. yaxty yw fae y ‘The minimum number of total variables required 10 convert the above code segment of static single assignment form is Sol. (7) 20. Consider an arbitrary set of CPU-bound processes, with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process scheduling algorithms would ‘minimise the average waiting time in the ready ‘queue? (a) Shortest remaining time first (b) Round-robie with time quantum less chan the shortest CPU burst () Uniform random (4) Highest priority first with priorty proportional to CPU Durst length ‘Sol. (a) To minirise the average waiting time, we need to select the shortest remaining time process frst, because all fare artving at the same time, and they have unequal (CPU burst tres. All other options wil not minimise the wating time. So, the answer ts SAF algocthm. 21. Which of the following is not a superkey in a relational schema with attributes WX, ¥ Zand primary key V¥? (ay vv (b) vox to wx (ay vay Sol. (o) Super key = Candidate Key + other attributes, But option B does nat inclide Y whicr is @ part of primary key or candidate key. 22. Which one of the following Is not a part of the ACID properties of database transactions? (a) Atomicity (b) Consistency {€) Isolation (4) Deadlock freedom Sol. (6) D re'ors to Durabily, 23. A database of research articles in a journal uses the following schema. (VOLUME, NUMBER, STARTPAGE, ‘YEAR, PRICE) ‘The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following functional dependencies ‘exist in the schema, (VOLUME, NUMBER, STARTPAGE, ENDPAGE) — TITLE (VOLUME, NUMBER) ~> YEAR (VOLUME, NUMBER, STARTPAGE, ENDPAGE) — PRICE ‘The database is redesigned to use the following schemas. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE) (VOLUME, NUMBER, YEAR} ‘Which is the weakest normal form that the new database satisfies, but the old one does not? (a) INF (b) 2NF (o3NF (a) BONE Sol. (o) Volume, Number -> Year is partial dependency, So, t does nol folow 2NF. But decomposed relation folows. ENDPAGE, TITLE, 24. Which one of the following protocols is not used to resolve one form of address to another onc? (a) Ns (b) ARP (c) DHCP (a) RARP Sol. (a} ONS is used for mapoing host name to IP Address 25. Which of the following is/are example(s) of stateful application layer protocols? 1. HTTP M1 FIP, ML TCP 1. POPS, (a) Land I (¢)Mandv (b) Wand a (a) Only 1V GATE 2016 | 5 Sol. (0) In computing, a siatolss protocol is a communications protocol that treats each request as an independent transaction thal is unrelated to ‘any previous request, So that the communication Consists of independent pais of request and response. Examples of statless protocols (P) and (HTTP) TOP is stateful as it maintaine connection information across multiple ransters, but TCP is not an application layer protocol (2 Marks Questions) 26. The coefficient of x"? in (eter ey? ‘Sol. (10) The expression can be rewriten as (hd eA eee PE Sxpanding binomial ‘expansion (1+ Gt x? 22) 214 34? 48) 492 12 (Qe 22 48) 24 3x2 x11 Bh? 4 The caeticient of x* willbe 10, it is mubolieg by outside, sa coeticiont of x" is 10, (exter) using 27. Consider the recurrence relation ay, 4, $60? 42nbayy. Let, ayy =KX104, The value of K is Sol. (198) =8 a, =8r? 4206, a, =6lN? +01 2+ 9M aa Continuing the same way til =2, we get a, = 6In? + 9-1 + 9-2F + OF +2104 0-1] Hn2).+4 3 bin? +(n-AF 4-24... OF] $2ln-+(0~ 1} 2. ADI] In? + (9-18 2). + BF 42n+(n-TI}+ (n= 2H..42)]+ 642 in? (0A +n P +1) alps f= 14 (0-2) Dx(ne tent) (n+) inyxin= xn +2) india xin) =2xinxin 1? Now, put n= 99 ap = 2x99x( 100)" = 1980000 = K x10" “Thereore, K = 198 #0) 1) 6 | Solved Paper : Computer Science and IT defined on the set of following 28. A function f:N* > N*, positive integers N*, properties satisfies the Son) Lon Let, R={i]3 js) =) be the set of distinet values that f takes. The maximum possible size of ® is (01/2) ifm is even (or +5) ifm is odd Sol. (2) Let us assume: f() =x. #212) 13) =118+ 5). (8/2) = 141 2)= 1121) =!) Silay, (4) 18) So, it wil have two values All mutiples of § wil have value y and others wil have value x. It wil have 2 diferent values. 29. Consider the following experiment, Step I. Flip a fair coin twice. Step I. If the outcomes are (TAILS, HEADS), then ‘output ¥ and stop. Step ML. If the outcomes are either (HEADS, HEADS) or (HEADS, TAILS), then output Nand stop, Step IV. If the outcomes are (TAILS, TAILS), then go to Step I ‘The probability that the output of the experiment is Vis (up to two decimal places) Sol. (0.33) SENT-W stop pony 7 or The tee hagram forthe processes fs given above “The costes outs i Now oy ool probatity p (output = 7)=0.9%0.5+ OSxO5x05x0.5+ Infinite geometic series with a= 05x05 025 a = 0.33 (upte 2 diagonal places) 380. Consider the two cascaded 2-to-1 multiplexers as shown in the figure. 7 —pae) Lee fh we Lo ee I I , a inimal sum of products form of the output X is (a) FO + POR (b) Fa QR (c) PQ+ FOR (a) OR + POR Sol. (d) MUX-1 ourput =» P (0) PF): MUX2 output =» X= (+ Q (PR) = H+ POR 31. The size of the data count register of a DMA controller is 16 bits. The processor needs to transfer a file of 29,154 kilobytes from disk to main memory. The memory is byte addressable. The minimum number of times the DMA controller needs to get the control of the system bus from the processor to transfer the file from the disk to main memory is ‘Sol, (456) Data count register gives the number of words the DMA ‘can transfer in a single cycle. Here, i is 16 bits. So, max 2" words can be transferred in lone cyole. Since memory is byte addressable t word = 1 byte 80,2" bytes in 1 cycle Now, for the given file Filesize = 29154KB * 2" Bin 1 oylee DMA tansters 2" 8 i.e, 1 B transferred by DMA = 12" cycles Now, for ful fe of size 29154 KB, minimum number of cycles (29154 +2"? By 12! = 455.63 ‘but numberof cycles is asked! so 455.53 is 456, 32, ‘The stage delays in a 4-stage pipeline are 800, $00, 400 and 300 picoseconds. The first stage (with delay 800 picoseconds) is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds. The throughput increase of the pipeline is, percent. Sol, (33.33% increase) Initial throughput is 1 instruction for 3200 picoseconds Reason : 4% 800 (here 800 is maximum stage delay of ary slage in an insttucion so ls selected as synchronous. lock cycle te) In the nest design, throughput will be 1 instruction for 2400 picoseconds reason : 4° 600 (here 600 fs maximum stage delay of ary stage in an instruction, so is selected as synchronous clock cele time}. Now increase in throughput is calculated by (¢142400)(1/ 3200)/ (1/ 2200)" 100 33, Now, there is an assumption thal the pipeline used is synchronous because IF asynchronous is used the through put is droped but not incroasoa, Consider a cay lookahead adder for adding swo n-bit Integers, built using gates of fan-in at most two. The time to perform addition using this adder is (ay) (b) ogi) (c)@Wn) (4) OM Sol. (o) The gales to be used in CLA adder wilh the far-in athe 34, most '2. Time to perform addition using this adder is (log in, ‘The following function computes the maximum value contained in an integer array p[] of size n(n > int maxCint *p, intn) ‘ int 2-0, ben-1 while ) ifcplal < ptb) nl a > else babel: ) ) return pla] ) ‘The missing loop condition is fayaten (b) bt b> a+ (abe Sol. (0) Hincludeciostream int maxCint #p, int n) int a-0. ben-1 white(al=b) ifeplaleptbD ‘ aad , else ( beb-1 > return pLal: > int maine) i int arrCI=(10,5,1,40,30); int n=size of(arr)/size of(arrl0]) std: :count< prints 31. 2, count) will print the vale of n and d and Increments ¢ and call coun) => prints 22, 3, count(}) wil print the vale of n and d and Increments. ¢ => prints 13, Now it wil etum and prints the final incremented value of d which is 4, 3 times, So, output will be printed in solution Le, 312213444 What will be the output of the following pseudo-code when parameters are passed by reference and dynamic scoping is assumed? of void ntx) ‘ prints oid my) arlranyca: nvad print(a)s ? void maing) mca) (6.2 (0)66 42 (A n(2) {x=242=4 pint 4) i since dynamic scoping is used print 2 37. Solved Paper : Computer Science and IT ‘An operator delete (@ for a binary heap data structure is to be designed to delete the item in the i-th node. Assume that the heap is implemented in an array and i refers to the f-th index of the array: If the heap tree hhas depth d (number of edges on the path from the root to the farthest leaf), then what is the time complexity to re-fix the heap efficiently after the removal of the element? fa) oq) (b) O42 but not Of) (6) 0124) but not 044) (4) 04424 but not 012") Sol. (0) Heap is implemented using array. fs parent element 38. thon 27 is Tot child and 21+ is eight cil, So, fan element is delete trom last level of the heap then it wil take O(1) time. Since element can be doleted from any kel of reap tree is worst case rool floment is deleted then at avery level one element is exchange. Minimum O(a) time will take f a element is deleted in heap tree but nat (1) Consider the weighted undirected. graph with 4 vertices, where the weight of edge (7) is given by the entiy Wj inthe matic We fo 28 5 5 wo 8 B50 x 58 x 0 ‘The largest possible integer value of x, for winich at least one shortest path between some pair of vertices ‘will contain the edge with weight x is Sol. (¢=12) Here, when we read the last sentence of the question, ie. the largest possible integer value of x when x=11 , shortest path is edge with weight x only But when x12, here are 2 shortest paths, and we can say that the edge with weight x is also a shortest path. Alleast 1 shores! path contain edge x. So answer will be 12, 39, Sol. Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5 and 6. ‘The maximum possible weight that a minimum ‘weight spanning tree of G can have is ® Sie graph wil be complete graph contain 4 vertex and 6 edges with weigth 1, 2, 8, 4, 5,6. 1 fs > fa dl 7 we consider edge weighs in such order that form the ‘eycle, then we have to choose two minimum we ‘choose minimum value Le, 4 80 MST willbe SS 0, max weight wil be 1+2-+ V,E) is an undirected simple graph in. which cach edge has a distinct weight, and ¢ is a particular Sol. edge of G. Which of the following statements about the minimum spanning trees (MSTs) of G is/are true? L. Ifeis the lightest edge of some cycle in 6, then, every MST of G includes ¢ IL. Ifeis the heaviest edge of some cycle in G, then every MST of G excludes ¢ (a) Oaly 1 (b) Only 1 (c) Both and it (4) Neither Enor 11 (©) Vis NOT true Suppose in a rectanguler with sides (1, 2,4, 5) and 3 is the weight of the diagonal connecting vertex between (4, 5) and (1, 2), nore e =3s the lightest edge of some ‘eyelo in G but in MST itis not including. 11 am wrong ‘can anyone please explain me why ? His true Let the heaves edge be @. Suppose the minimum spaning twee which contains o. If we adé one more ‘edge to the spanning toe wo will create a cyte Suppose wo add odgo oto the spanning troo which generated cycle C. Wo can reduce the cost of the minimum spanning trae if we choose an edge ather than e fram C for removal which imples that e must not be in minimum spanning ‘tee and we get a contradiction 41. Let Q denote a queue containing sixteen numbers and § be an emply stack. Head (Q) retums the element at the head of the queue Q without removing it from @. Similarly Top (9) returns the element at the top of 8 ‘without removing it from 5, Consider the algorithm, given below. while Q is not Empty do if S is Empty or TOP(S}s Head(Q) then x 1 =Dequeue(0): Push(S, x): else eps) Enquewe(a, x) end end ‘The maximum possible number of iterations of the ‘while loop in the algorithm is ‘Sol. (256) The minimum number of terations of the wile loop. ‘of algorithm when use take quaue contain elernent in ascending order ie. 1, 2, 3 4 ny 168 16, The maximum number of “ievations of while loop. in ‘algorithm when we take queue containing elements in descending order ie. 16, 15,14... 1 Fst 16 will push into stack and then enqueue itn the fond of the queue. This process do Ill wo gat 1 as head element. When head point to 1 then simple push the 1 in slack. in this manner we have to push all element in slack in ascending order, until queue is GATE 2016 | 9 42, Consider the following context free grammars Gy 15-9 aS] B,B—> b|bB Gy :8 aA] bB, A ad] Ble, B bB|e Which one of the following pairs of languages is generated by G, and G,, respectively? (a) {a"®" | m> oor > 0} and "6" | m> Oand n> @ (b) (2"" | > Oand n > 0} and (a | m> 00 n 2 Ob (6) (@¥" [m2 O07 n> 0) and {a"6" | m> Oand n> OF (4) {a"6" | m > Oand > 0 and {aH | m> Orn > o) Sol. (6) G, Sas |B 8 b|e8 a S>aalbe As aAlBl B > bBl, G: Bb|b8 > Bb" Now substtuiein$ -> aS 18 We get aS |b" = Sab" So, L(G,)={a"b" |m 20 and n > 0} G)=B BB, 80° Subsitute in A-» aA], > A> afl b']e SAS aA 3 Avett Now substiule Aand 8 nS — a8] 8 38 as’ 1b0° Sade + bo $0, Liha) ={@%b" [m > 0 or > 0} 43. Consider the transition diagram of a PDA given below with input alphabet Z={a,6} and stack alphabet empty it wil take 258 of iterations Example r={X,Z}. Z is the initial stack symbol. Let L denote Forno [ST 211] the language accepted by the PDA, "est Fear a4m aah bxve Sequence of operation wih whle loop execution. I. dogueve @)—2.p00@) 3. doqueye @) Which one of the following is true? push () enqueue @) push (2) (a)L=(2's"|n20) and is not accepted by any finite 4. pop @) 5. dequeue (1) 6. dequeue (3) automata ‘enqueue (2) push (1) push (3) (b)L={a"| m2 0} w {a"b" | 20} and is not accepted by 7. pop @) 8. dequeue (2) 9. dequeue () any deterministic PDA. fnauoue (3) push) push (6) not accepted by any Turing. machine that halts on So, for n= 3it takes 3x3 8 iterations of while loop in every fap acorn 80, for 1a1é K wil the 1ex162258 (Ls telne OG [zc and As deterministic iteraions of vie op. 10 | Solved Paper : Computer Science and IT ‘Sol. (a) Tho fist stao accopts only null sting. Only 2's will not bbe accepted since on frst state e, X wil be dead reject. The thie state accopt is {a°b"|n > 1p Se Late} Ufa” 2p =a" |n> 0} CClealy this is a nonsegular CFL and hence not accepted by any FA. 44, Let X be a recursive language and ¥ be a recursively ‘enumerable but not recursive language. Let W and Z bee two languages such thal ¥ reduces to W, and Z reduces to X (reduction means the standard ‘many-one reduction). Which one of the following statements is true? (a) W can be recursively enumerable and Z is recursive {(b) W can be recursive and Z is recursively enumerable {c) W is not recursively enumerable and Z Is recursive. (d)W is not recursively enumerable and Z Is not Sol. (c) X is recursive language and Y is rocursive ‘enumerable language. Y bar reduces to W means - W is not recursive enumerable, Z reduces to X bar means -X is reausive henoe Z is also recursive as (A is reauible to B) .ie., soling A cannot be “harder than soking 8. 1. ifs reduciole to 8, and B is decidable, then A is decidable (0 If Ais reducible to B, and B is recursive, then A 2. |H/Nis undecidatle, and reducible to 8, then B is. undecidable (0 i Ais recursive enumerable, and reducible to B, then 8 is recursive enumerabl. (i i Ais not recursive enumerable, and reducible to. then Bis not rocusive erumerable, Hence, answer is © Z is not reowsive enumeracle and Z is recursive. 45. The attributes of three arithmetic operators in some programming language are given below. Operator Prec Associativty Arty + Hig Let Bay = Mesum Aight Bary Lew Let___Bnay ‘The value of the expression 2-5 41-7 "3 in this language is ‘Sol. 8) Since gven expression in inf expression. So we use operator stack 2—5+ 1-773 Push Push come Pop + soe + has because + has high printy igh poy FT] Pop $0,2,6=1) Jes = 7Jest S26 28 ‘come Push Push pop because has high piety than" = J] Pop 1 | 267 =] Pop2 So, 2=(6=7)_ ~ ight associive potas * Push Sting tis £0 pep =} 33 s0.973-8, $0. 2-5 + 1-7" 9 evaluates 109, 46, Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S,A} and terminals {a, b}. Soak { print 1 } Soa { print 2 } A> Sb { print 3 } Using the above SDTS, the output printed by a bottom-up parser, for the input aab is (a) 132 (b)223 (e231 (A) syntax error ol. (c)_aab could be derived as follows by the bottom up parser Sah prints 1 A aSb prints 3 A> aab pants 2 Now, since bottom up parser will workin reverse of right ‘most devation, so it wil prin in bottom up fashion ie, 231 whichis option C. Note tat this could also be vsualized easily by drawing the derivation tea 47, Consider a computer system with 40-bit virtual addressing and page size of sixteen kilobytes. If the computer system has a one-level page table per process and cach page table entry requires 48 bits, then the size of the per-process page table is ‘megabytes. Sol, (284 MB) (27*25* 6ytes) Page table enity size = at Number of pages =2740/21 Pago size =16 KB =214 Hence, size of per process page table = pages page table enty size = 2266 = 384 MB byte 726 umber of Sol. (348) 48. Consider a disk queue with requests for VO to blocks on cylinders 47, 38, 121, 191, 87, 11, 92, 10. The C-LOOK scheduling algorithm is used. The head is initially at cylinder number 63, moving towards larger cylinder numbers on its servicing pass. The cylinders are numbered from 0 to 199, The total head movement (in number of cylindets) incurred while servicing these requests is CA.o0% ho 11 39 47 69 @7 92 121199 87-63) + 92-87) + 121-92) 4091-121) 4{191—10} + (11-10) + 8811) + (47-38) 2445429470 41814142749 =346 49. Consider a computer system with ten physical page frames. The system is provided with an access sequence {a,,43,.--,Ago, &y/dy---aoh where each 4, is a distinct virtual page number. The difference the number of page faults between the last-in-first-out page replacement policy and the optimal page replacement policy is ‘Sol. (1) LIFO stands for Last In, First Out at to a10 will rosut in page fauts. So, 10 page fauts trom at to al0. Then, 11 will replace atQflast in is a10), 212 wil reolace att ‘and so on til a20, so 10 page fauts from att to a20 ‘and 220 will be top of slack and a9... are remained fas such, Then, al t0 a9 are akeady there. So, 0 page faults from at to 29, 210 will replace 20, a11 will eolace a1 and so on. So, 11 page fauts from a10 to 920, So total faults wil be 10410411 = 31 Optimal at to 410 wil resut in page ‘auts, So 10 page faults ‘fom at to at0. Then, att will replace a0 because among at to a10, a10 will be used later, a12 will replace at and so on. So, 10 page faut from att to a20 and a20 will be top of stack and 29...al are remained as such, Then, al to a9 are akcady there, So, © page fauts tom at to 2. 10 will replace at because it will not be used ahomards and so on, a10 to al wil have 10 page fauts. 220s already there, so no page fault for 220, ‘otal fauks 10+ 10+ 10 =20. Diference = 1 50. Sol. 51. GATE 2016 | 11 Consider the following proposed solution for the critical section problem. There are 1 processes Py oPyay- Im the code, function pmax returns an integer not smaller than any of its arguments. For all i, t{i] is inktialised to zero. Code for. ¢o ‘ cLilel: tL T=pmax(tco1, for every J#4 in (0, ‘ tin1D+1 n= whitece (92) whidece(s aa tt 1kely to beat all he three other players as P always beais ©, which always beats R, which alvays boats So, () can be inferted from tne gven statements. ‘All theo can boat, but S loses to P only sometimes. So, fi) can nat be in‘ered ttom the given statements, Thus, ais contest answer 64. If fix) =2x7 +3x- ;, which of the following is a factor of flu? ass (ore) ()ex-5 (ier Sol. (6) 1(x)=2x" + 3x-5 Use option (0), i (x1) wil be a factor then on pulting Le. (e=Hin fx), i) =20)" +3-5 65. In a process, the number of cycles to failure decreases ‘exponentially with an increase in load. At a load of ‘80 units, it takes 100 cycles for failure. When the load. is halved, it takes 10000 cycles for failure. The load for which the failure will happen in 5000 cycles is (2) 40.00 (c} 60.01 Sol. (0) (b) 46.02 (a) 92.02

You might also like