GATE  GATECS2014 (Set 1)1) Which of the following options is the closest in meaning to the phrase underlined in the sentence below? It is fascinating to see life forms cope with varied environmental conditions.
Answer: B Explanation: In the above phrase, underlined part is *cope with*. "Cope"  It's a verb. "adopt"  verb. "adapt"  verb. "adept"  adjective "accept"  verb Hence, only "adapt" goes right with the phrase described in the question. 2) Choose the most appropriate word from the options given below to complete the following sentence. He could not understand the judges awarding her the first prize, because he thought that her performance was quite. . . . . . . . . . . .
Answer: C Explanation: Here, superb and exhilarating would imply that the performance was brilliant. But, the fact that he could not understand why she got awarded the first prize indicates that her performance was not that amazing in his opinion. So, A and D are incorrect. Medium is more used as a noun, and denoted intermediate in quality, value, etc. So, B is incorrect Mediocre is used as an adjective (to represent quality) and means low in performance, i.e., normal and not extraordinary and C is the correct choice. 3) In a press meet on the recent scam, the minister said, "The buck stops here". What did the minister convey by the statement?
Answer: C Explanation: 'The buck stops here' means  Responsibility is not passed on beyond this point. Option (C) is correct. 4) IF (z + 1 / z)^{2} = 98, compute (z^{2} + 1 / z^{2})
Answer: A Explanation: (z + 1 / z)^{2} = (z^{2} + 1 / z^{2}) + 2 * z * 1 / z (z^{2} + 1 / z^{2}) = (z + 1 / z)^{2}  2 = 98  2 = 96 5) The roots of ax^{2} + bx + c are real and positive. a, b and c are real. Then ax^{2} + bx + c has
Answer: D Explanation: The second equation has both +vs and ve values of roots of first equation as root. 6) The Palghat Gap (or Palakkad Gap), a region about 30 km wide in the southern part of the Western Ghats in India, is lower than the hilly terrain to its north and south. The exact reasons for the formation of this gap are not clear. It results in the neighbouring regions of Tamil Nadu getting more rainfall from the South West monsoon and the neighbouring regions of Kerala having higher summer temperatures. What can be inferred from this passage?
Answer: C Explanation: Here the passage is asking, " what can be inferred ? ", i.e. it's asking about the hidden conclusion of the passage. Why not Option A ?  because it is clearly given in the passage : "The exact reasons for the formation of this gap are not clear ". Why not Option B ?  because the passage does not talk about the lowlying regions of Kerala and Tamil Nadu near the Palghat Gap. Why not option D ?  Because the passage only says : "neighbouring regions of Kerala having higher summer temperatures", it doesn't say that this high temperature results in rainfall. Note: We have to think and conclude only from what is given in the passage. We can't make our own conclusions.Why Option C ?  because the passage says : " It results in the neighbouring regions of Tamil Nadu getting more rainfall from the South West monsoon and the neighbouring regions of Kerala having higher summer temperatures", Therefore, option C is correct. 7) Geneticists say that they are very close to confirming the genetic roots of psychiatric illnesses such as depression and schizophrenia, and consequently, that doctors will be able to eradicate these diseases through early identification and gene therapy. On which of the following assumptions does the statement above rely?
Answer: B Explanation:
So, B is the correct option 8) Roundtrip tickets to a tourist destination are eligible for a discount of 10% on the total fare. In addition, groups of 4 or more get a discount of 5% on the total fare. If the one way single person fare is Rs 100, a group of 5 tourists purchasing roundtrip tickets will be charged Rs. . . . . . . . . . . . . . . .
Answer: a Explanation: One way single person fare is 100. Therefore, 2 way is 200. For 5 persons it is 200 x 5 = 1000 Now 1st discount is of 10 % on total fare, which is 100( 10 % of 1000). And as the group is of more than 4, an additional discount of 5 % on total fare, which is 50( 5 % of 1000). Hence total discount is equal to 100 + 50 = 150. Therefore tickets are charged at Rs 1000  150 = 850. 9) In a survey, 300 respondents were asked whether they own a vehicle or not. If yes, they were further asked to mention whether they own a car or scooter or both. The irresponses are tabulated below. What percent of respondents do not own a scooter?
Answer: a Explanation: No. of respondents do not own scooter = No. of persons who have car alone + No. of persons who don't have both. In men, 40 + 20 = 60 and In women 34 + 50 = 84. Total 60 + 84 = 144 . Now the percentage is, (144 / 300) *100 = 48 10) When a point inside of a tetrahedron (a solid with four triangular surfaces) is connected by straight lines to its corners, how many (new) internal planes are created with these lines? . . . . . . . . . . . . . . . . . . . .
Answer: a Explanation: The Tetrahedron has 4 triangular surfaces with 4 vertices/corners ( say A,B,C and D). Now if you take a point inside a tetrahedron (suppose O) and connect it with any two of its corners which are nothing but vertices (suppose A and B), you will get 1 internal plane as OAB. So we can see from here that, no of new internal planes = no of different pair of corners or vertices. Similarly you can take any other 2 corners like (A, C) or (A, D) or (B, C) or (B, D) or (C, D). We could also calculate the possible corners by using combinations formula, 11) Consider the statement Not all that glitters is gold Predicate glitters(x) is true if x glitters and predicate gold(x) is true if x is gold. Which one of the following logical formulae represents the above statement?
Answer: d Explanation: The statement "Not all that glitters is gold" can be expressed as follows: ¬(∀x(glitters(x)⇒gold(x)). . . . . . . . . . . . . . . . . . (1) Where ∀x(glitters(x)⇒gold(x) refers that all glitters is gold. Now, ∃x¬(glitters(x)⇒gold(x)) . . . . . . . . . . . . . . . . . . . . . . .(2) , Since we know ¬∀x() = ∃x¬() (Where ∀ refers to > All and ∃x refers to > There exists some). As we know, A⇒B is true only in the case that either A is false or B is true. It can also defined in the other way : A⇒B=¬A∨B (negationA or B ) . . . . . . . . . . . . . . . . . . . . . . .(3) From equation (2) and (3) , we have ⇒∃x(glitters(x)∧¬gold(x)) . . . . . . . . . . . . . . . . . . . . (4) , Negation cancellation ¬(¬) = () : and ¬(()∨()) = (¬()∧¬()) . So Answer is (D). 12) Suppose you break a stick of unit length at a point chosen uniformly at random. Then the expected length of the shorter stick is . . . . . . . . . . . .
Answer: a Explanation: The smaller sticks will range in length from almost 0 unit up to a maximum of 0.5 unit, with each length equally possible. Therefore, the average length will be about (0 + 0.5) / 2 = 0.25 unit, which is answer. 13) Let G=(V,E) be a directed graph where V is the set of vertices and E the set of edges. Then which one of the following graphs has the same strongly connected components as G?
Answer: b Explanation: If we reverse directions of all arcs in a graph, the new graph has same set of strongly connected components as the original graph. 14) Consider the following system of equations: 3x + 2y = 1 4x + 7z = 1 x + y + z = 3 x  2y + 7z = 0 The number of solutions for this system is . . . . . . . . . . . . . . .
Answer: a Explanation: rank(Augmented Matrix) = rank(Matrix) = no of unknowns. Hence it has a unique solution. 15) The value of the dot product of the eigenvectors corresponding to any pair of different eigenvalues of a 4by4 symmetric positive definite matrix is . . . . . . . . . . . . . . .
Answer: a Explanation: The eigen vectors corresponding to different eigen values of a real symmetric matrix are orthogonal to each other. And dot product of orthogonal vectors is 0. 16)
Answer: c Explanation: In the given question, ⊝ranges fromπ / 6 to π/ 3. When ⊝=π / 6 , the value of the function is 0, since Rows 1 and 2 are the same. When ⊝ = / 3 , the value of the function is 0, since Rows 1 and 3 are the same. The given function is continuous and differentiable in the given range since it is a trigonometric function. Then According to the Mean Value Theorem, There exists a value c of such that f'(c) = 0. So the first statement is true. Also there may also exist a value c, such that f'(c) ? 0. This is because the function is not a constant function, i.e. all values in the range are not equal to c. So the second statement is also true. Therefore the correct option is C. 17) Consider the following Boolean expression for F: F(P, Q, R, S) = PQ + P'QR + P'QR'S The minimal sumofproducts form of F is
Answer: a Explanation: Given, F(P, Q, R, S) = PQ + P'QR + P'QR'S = Q(P + P'R + P'R'S) = Q(P + R + R'S) = Q(P + R + S) = PQ + QR + QS Note that A + AB = A and A + A'B = A + B. So, option (A) is correct. 18) The base (or radix) of the number system such that the following equation holds is. . . . . . . 312/20 = 13.1
Answer: c Explanation: Let x (≠ 0) be the base of the given equation. We have, LHS = ( 3x^{2} + x + 2 ) / ( 2x) = ( 3x / 2 ) + ( 1 / 2 ) + ( 1 / x ) RHS = x + 3 + ( 1 / x ) Now, for the equation to hold true, LHS = RHS ( 3x / 2 ) + ( 1 / 2 ) + ( 1 / x ) = x + 3 + ( 1 / x ) ⇒ 3x + 1 = 2x + 6 ⇒ x = 5 So, the base is 5. 19) Consider the following program in C language: Which one of the following statements is TRUE?
Answer: d Explanation: There is no problem in the program as pi points to a valid location. Also, in scanf() we pass address of a variable and pi is an address. 20) Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time on Depth First Search of G? Assume that the graph is represented using adjacency matrix.
Answer: c Explanation: Depth First Search of a graph takes O(m + n) time when the graph is represented using adjacency list. In adjacency matrix representation, graph is represented as an "n x n" matrix. To do DFS, for every vertex, we traverse the row corresponding to that vertex to find all adjacent vertices (In adjacency list representation we traverse only the adjacent vertices of the vertex). Therefore time complexity becomes O(n^{2}) 21) Consider a rooted Binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having exactly 4 nodes O(na Logn b). Then the value of a + 10b is . . . . . . . .
Answer: a Explanation: We can find the subtree with 4 nodes in O(n) time. Following can be a simple approach. 1) Traverse the tree in bottom up manner and find size of subtree rooted with current node 2) If size becomes 4, then print the current node. Following is C implementation 22) Consider the directed graph given below. Which one of the following is TRUE?
Answer: c Explanation: The graph doesn't contain any cycle, so there exist topological ordering. P and S must appear before R and Q because there are edges from P to R and Q, and from S to R and Q. 23) Let P be a QuickSort Program to sort numbers in ascending order using the first element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?
Answer: c Explanation: When first element or last element is chosen as pivot, Quick Sort's worst case occurs for the sorted arrays. In every step of quick sort, numbers are divided as per the following recurrence. T(n) = T(n  1) + O(n) 24) Which one of the following is TRUE?
Answer: c Explanation: (A) L = {a n b n n >= 0} is not regular because there does not exists a finite automaton that can derive this grammar. Intuitively, finite automaton has finite memory, hence it can't track number of states. It is a standard Context Free Language though. (B) L = {a n b n n is prime} is again not regular because there is no way to remember/check if current n is prime or not. Hence, no finite automaton exists to derive this grammar, thus it (C) L = {ww has 3k+1 bs} is a regular language because k is a fixed constant and we can easily emulate L as a ∗ba∗ . . . . . . . . . ba∗ such that there are exactly 3k + 1 bs and a ∗ s surrounding each b in D) L = {ww  w ∈ Σ ∗ } is again not a regular grammar, in fact it is not even a CFG. There is no way to remember and derive double word using finite automaton. Hence, correct answer would be (C). 25)
Answer: a Explanation: So, q0, q1 and q2 are reachable states for the input string 0011, but q3 is not. So, option (A) is answer. 26) A machine has a 32bit architecture, with 1word long instructions. It has 64 registers, each of which is 32 bits long. It needs to support 45 instructions, which has an immediate operand in addition to two register operands. Assuming that the immediate operand is an unsigned integer, the maximum value of the immediate operand is . . . . . . . .
Answer: a Explanation: 1 Word = 32 bits Each instruction has 32 bits. To support 45 instructions, opcode must contain 6bits. Register operand1 requires 6 bits, since the total registers is 64. Register operand 2 also requires 6 bits. So total 18 bits for all 45 instructions and two register operands. So, 3218 = 14 14bits are left over for immediate Operand, now 2^14  1 = 16383 We can give maximum 16383. 27) Which one of the following is FALSE?
Answer: d Explanation: (A) A basic block is a sequence of instructions where control enters the sequence at the beginning and exits at the end is TRUE. (B) Available expression analysis can be used for common subexpression elimination is TRUE. Available expressions are an analysis algorithm+ that determines for each point in the program about the set of expressions that need not be recomputed. Available expression analysis is used to do global common subexpression elimination (CSE). If an expression is available at a point, there is no need to reevaluate it. (C) Live variable analysis can be used for dead code elimination is TRUE. (D) x = 4 ∗ 5 => x = 20 is an example of common subexpression elimination is FALSE. Common subexpression elimination (CSE) refers to compiler optimization replaces identical expressions (i.e., they all evaluate to the same value) with a single variable holding the computed value when it is worthwhile to do so. Below is an example In the following code: a = b * c + g; d = b * c * e; It may be worth transforming the code to: tmp = b * c; a = tmp + g; d = tmp * e; 28) Match the following:
Answer: b Explanation:
                                                           
                                                           
                                                           
29) Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the disk arm is at cylinder 100, and there is a queue of disk access requests for cylinders 30, 85, 90, 100, 105, 110, 135 and 145. If ShortestSeek Time First (SSTF) is being used for scheduling the disk access, the request for cylinder 90 is serviced after servicing. . . . . . . . . . . . . . . . . . . 2 number of requests.
Answer: c Explanation: In ShortestSeekFirst algorithm, request closest to the current position of the disk arm and head is handled first. In this question, the arm is currently at cylinder number 100. Now the requests come in the queue order for cylinder numbers 30, 85, 90, 100, 105, 110, 135 and 145. The disk will service that request first whose cylinder number is closest to its arm. Hence 1st serviced request is for cylinder no 100 ( as the arm is itself pointing to it ), then 105, then 110, and then the arm comes to service request for cylinder 90. Hence before servicing request for cylinder 90, the disk would have serviced 3 requests. Hence option C. 30) Which one of the following is FALSE?
Answer: d Explanation:
31) Consider the relation scheme R = {E, F, G, H, I, J, K, L, M, M} and the set of functional dependencies {{E, F} > {G}, {F} > {I, J}, {E, H} > {K, L}, K > {M}, L > {N} on R. What is the key for R?
Answer: b Explanation: All attributes can be derived from {E, F, H} To solve these kinds of questions that are frequently asked in GATE paper, try to solve it by using shortcuts so that enough amount of time can be saved. Fist Method: Using the given options, try to obtain closure of each options. The solution is the one that contains R and also minimal Super Key, i.e. Candidate Key. A) {E, F}+ = {E, F, G, I, J} ≠ R(The given relation) B) {E, F, H}+ = {E, F, G, H, I, J, K, L, M, N} = R (Correct since each member of the given relation is determined)C) {E, F, H, K, L}+ = {E, F, G, H, I, J, K, L, M, N} = R (Not correct although each member of the given relation can be determined but it is not minimal, since by the definition of Candidate key it should be minimal Super Key)D) {E}+ = {E} ≠ R Second Method: Since, {E, F, G, H, I, J, K, L, M, N}+ = {E, F, G, H, I, J, K, L, M, N}{E, F, G, H, I, J, K, L, M}+ = {E, F, G, H, I, J, K, L, M, N} ( Since L > {N}, hence can replace N by L)In a similar way, K > {M} hence replace M by K{E, F, G, H, I, J, K, L}+ = {E, F, G, H, I, J, K, L, M, N} Again {E, F, G, H, I, J}+ = {E, F, G, H, I, J, K, L, M, N} (Since {E, H} > {K, L}, hence replace KL by EH){E, F, G, H}+ = {E, F, G, H, I, J, K, L, M, N} (Since {F} > {I, J} ){E, F, H}+ = {E, F, G, H, I, J, K, L, M, N} (Since {E, F} > {G} ) 32) Given the following statements: S1: A foreign key declaration can always be replaced by an equivalent Checkassertion in SQL. S2: Given the table R(a,b,c) where a and b together form the primary key, the following is a valid table definition. Which one of the following statements is CORRECT?
Answer: d Explanation: Check assertions are not sufficient to replace foreign key. Foreign key declaration may have cascade delete which is not possible by just check insertion. Using a check condition, we can have the same effect as Foreign key while adding elements to the child table. But when we delete an element from the parent table, the referential integrity constraint is no longer valid. So, a check constraint cannot replace a foreign key. So, we cannot replace it with a single check. S2: Given the table R(a, b, c) where a and b together form the primary key, the following is a valid table definition. False: Foreign key in one table should uniquely identify a row of another table. In above table definition, table S has a foreign key that refers to field 'a' of R. The field 'a' in table S doesn't uniquely identify a row in table R. 33) Consider the following three statements about link state and distance vector routing protocols, for a large network with 500 network nodes and 4000 links. [S1] The computational overhead in link state protocols is higher than in distance vector protocols.                                                             [S2] A distance vector protocol (with split horizon) avoids persistent routing loops, but not a linkstate protocol.                                                             [S3] After a topology change, a link state protocol will converge faster than a distance vector protocol.                                                             Which one of the following is correct about S1, S2, and S3 ?
Answer: d Explanation: Linkstate: Every node collects complete graph structureEach computes shortest paths from itEach generates own routing table DistancevectorNo one has copy of graphNodes construct their own tables iterativelyEach sends information about its table to neighbours [S1] The computational overhead in link state protocols is higher than in distance vector protocols.                                                             [S2] A distance vector protocol (with split horizon) avoids persistent routing loops, but not a linkstate protocol.                                                             [S3] After a topology change, a link state protocol will converge faster than a distance vectorprotocol. S1 is clearly true as in Link State all nodes compute shortest path for whole network graph. S3 is also true as Distance Vector protocol has count to infinity problem and converges slower. S2 is false. In distance vector protocol, split horizon with poison reverse reduces the chance of forming loops and uses a maximum number of hops to counter the 'counttoinfinity' problem. These measures avoid the formation of routing loops in some, but not all, cases 34) Which of the following are used to generate a message digest by the network security protocols? (P) RSA (Q) SHA1 (R) DES (S) MD5
Answer: c Explanation:
Q and S i.e. SHA 1 and MD5 are used to generate a message digest by the network security protocols. So, C is the correct choice. 35) Identify the correct order in which the following actions take place in an interaction between a web browser and a web server. 1. The web browser requests a webpage using HTTP. 2. The web browser establishes a TCP connection with the web server. 3. The web server sends the requested webpage using HTTP. 4. The web browser resolves the domain name using DNS.
Answer: a Explanation: The web browser first needs to figure out IP address of site from url using DNS, then establishes a TCP connection, typically at port 80. Once the TCP connection is established, the browser sends a HTTP request using GET. Finally web server responds with HTTP response. 36) Consider a token ring network with a length of 2 km having 10 stations including a monitoring station. The propagation speed of the signal is 2 × 10^{8} m/s and the token transmission time is ignored. If each station is allowed to hold the token for 2 μsec, the minimum time for which the monitoring station should wait (in μsec) before assuming that the token is lost is. . . . . . . . . . .
Answer: a Explanation: Length = 2 km Propagation Speed v = 2 * 10^8 m/s Token Holding Time = 2 micro sec Waiting time = length / speed + (#stations  1) * (token holding time) to length / speed + (#stations) * (token holding time)= 28 to 30 37) Let the size of congestion window of a TCP connection be 32 KB when a timeout occurs. The round trip time of the connection is 100 msec and the maximum segment size used is 2 KB. The time taken (in msec) by the TCP connection to get back to 32 KB congestion window is. . . . . . . . . . . ..
Answer: a Explanation: Current size of congestion window in terms of number of segments= (Size in Bytes)/(Maximum Segment Size) = 32KB / 2KB = 16 MSS When timeout occurs in TCP's Slow Start algorithm, threshold is reduced to half which is 16KB or 8MSS. Also, slow start phase begins where congestion window is increased twice. So from 1MSS to 8 MSS, window size will grow exponentially. Congestion window becomes 2MSS after one RTT and becomes 4MSS after 2 RTTs and 8MSS after 3 RTTs. At 8MSS, threshold is reached and congestion avoidance phase begins. In congestion avoidance phase, window is increased linearly. So to cover from 8MSS to 16MSS, it needs 8 RTTs. Together, 11RTTs are needed (3 in slow start phase and 8 in congestionavoidance phase). 38) Consider a selective repeat sliding window protocol that uses a frame size of 1 KB to send data on a 1.5 Mbps link with a oneway latency of 50 msec. To achieve a link utilization of 60%, the minimum number of bits required to represent the sequence number field is. . . . . . . . . .
Answer: c Explanation: Transmission delay = Frame Size/bandwidth= (1 * 8 * 1024) / (1.5 * 10^6) = 5.33ms Propagation delay = 50ms Efficiency = Window Size / (1 + 2a) = .6 a = Propagation delay/Transmission delay So, window size = 11.856(approx.) min sequence number = 2 * window size = 23.712 bits required in Min sequence number = log_{2}(23.712) Answer is 4.56 =>Ceil(4.56) = 5 39) Consider the following four schedules due to three transactions (indicated by the subscript) using read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of them is conflict serializable.
Answer: d Explanation: In option D, there is no interleaving of operations. The option D has first all operations of transaction 2, then 3 and finally 1 There cannot be any conflict as it is a serial schedule with sequence 2 > 3 ? > 1 40) Given the following two statements: Which one of the following is CORRECT?
Answer: a Explanation: S1: Every table with two singlevalued attributes is in 1NF, 2NF, 3NF and BCNF. A relational schema R is in BCNF if in Every nontrivial Functional Dependency X>Y, X is Super Key. If we can prove the relation is in BCNF then by default it would be in 1NF, 2NF, 3NF also. Let R(AB) be a twoattribute relation, then
Hence, it's proved that a Relation with two single  valued attributes is in BCNF hence it's also in 1NF, 2NF, 3NF. Hence S1 is true. S2: AB > C, D > E, E > C is a minimal cover for the set of functional dependencies AB > C, D > E, AB > E, E > C. As we know Minimal Cover is the process of eliminating redundant Functional Dependencies and Extraneous attributes in Functional Dependency Set. So each dependency of F = {AB > C, D > E, AB > E, E > C} should be implied in minimal cover. As we can see AB > E is not covered in minimal cover since {AB}+ = ABC in the given cover {AB > C, D > E, E > C} Hence, S2 is false. 41) An operating system uses the Banker's algorithm for deadlock avoidance when managing the allocation of three resource types X, Y, and Z to three processes P0, P1, and P2. The table given below presents the current system state. Here, the Allocation matrix shows the current number of resources of each type allocated to each process and the Max matrix shows the maximum number of resources of each type required by each process during its execution. There are 3 units of type X, 2 units of type Y and 2 units of type Z still available. The system is REQ1: P0 requests 0 units of X, 0 units of Y and 2 units of Z REQ2: P1 requests 2 units of X, 0 units of Y and 0 units of Z Which one of the following is TRUE?
Answer: b Explanation: This is the current safe state. AVAILABLE X=3, Y=2, Z=2 Now, if the request REQ1 is permitted, the state would become: AVAILABLE X=3, Y=2, Z=0 Now, with the current availability, we can service the need of P1. The state would become: AVAILABLE X = 6, Y = 4, Z = 0 With the resulting availability, it would not be possible to service the need of either P0 or P2, owing to lack of Z resource. Therefore, the system would be in a deadlock. ⇒ We cannot permit REQ1. Now, at the given safe state, if we accept REQ2 : AVAILABLE X = 1 , Y = 2, Z = 2 With this availability, we service P1 (P2 can also be serviced). So, the state is : With the current availability, we service P2. The state becomes: Finally, we service P0. The state now becomes: The state so obtained is a safe state. ⇒ REQ2 can be permitted. So, only REQ2 can be permitted. Hence, B is the correct choice. 42) Consider the following set of processes that need to be scheduled on a single CPU. All the times are given in milliseconds. Using the shortest remaining time first scheduling algorithm, the average process turnaround time (in msec) is . . . . . . .
Answer: a Explanation: Turnaround time of a process is total time between submission of the process and its completion. Shortest remaining time (SRT) scheduling algorithm selects the process for execution which has the smallest amount of time remaining until completion. Solution: Let the processes be A, C, D and E. These processes will be executed in following order. Gantt chart is as follows: First 3 sec, A will run, then remaining time A=3, B=2,C=4,D=6,E=3. Now B will get chance to run for 2 sec, then remaining time. A=3, B=0,C=4,D=6,E=3 Now A will get chance to run for 3 sec, then remaining time. A = 0, B = 0,C=4,D=6,E=3 By doing this way, you will get above gantt chart. Scheduling table: AT = Arrival Time, BT = Burst Time, CT = Completion Time, TAT = Turn Around Time As we know, turnaround time is total time between submission of the process and its completion. i.e. turnaround time=completion timearrival time. i.e., TAT=CTAT Turnaround time of A = 8 (8  0) Turnaround time of B = 2 (5  3) Turnaround time of C = 7 (12  5) Turnaround time of D = 14 (21  7) Turnaround time of E = 5 (15 10) Average turnaround time is (8 + 2 + 7 + 14 + 5) / 5 = 7.2. Answer is 7.2. Alternate Explanation: After drawing Gantt ChartCompletion Time for processes A, B, C, D and E are 8, 5, 12, 21 and 15 respectively.Turnaround Time = Completion Time  Arrival Time 43) Assume that there are 3 page frames which are initially empty. If the page reference string is 1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6, the number of page faults using the optimal replacement policy is. . . . . . . . . . .
Answer: c Explanation: In optimal page replacement policy, we replace the place which is not used for longest duration in future. Given three page frames. Reference string is 1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6 Initially, there are three page faults and entries are 1 2 3 Page 4 causes a page fault and replaces 3 (3 is the longestdistant in future), entries become 1 2 4 Total page faults = 3+1 = 4 Pages 2 and 1 don't cause any fault. 5 causes a page fault and replaces 1, entries become 5 2 4 Total page faults = 4 + 1 = 5 3 causes a page fault and replaces 5, entries become 3 2 4 Total page faults = 5 + 1 = 6 3, 2 and 4 don't cause any page fault. 6 causes a page fault. Total page faults = 6 + 1 = 7 44) A canonical set of items is given below S > L.> R Q > R. On input symbol < the set has
Answer: d Explanation: The question is asked with respect to the symbol ' < ' which is not present in the given canonical set of items. Hence it is neither a shiftreduce conflict nor a reducereduce conflict on symbol '<'. Hence D is the correct option. But if the question would have asked with respect to the symbol ' > ' then it would have been a shiftreduce conflict. 45) Let L be a language and L' be its complement. Which one of the following is NOT a viable possibility?
Answer: c Explanation: A) It is possible if L itself is NOT RE. Then L' will also not be RE. B) Suppose there is a language such that turing machine halts on the input. The given language is RE but not recursive and its complement is NOT RE. C) This is not possible because if we can write enumeration procedure for both languages and it's complement, then the language becomes recursive. D) It is possible because L is closed under complement if it is recursive. Thus, C is the correct choice. 46) Which of the regular expressions given below represent the following DFA? I) 0*1(1+00*1)* II) 0*1*1+11*0*1 III) (0+1)*1
Answer: b Explanation: I) 0 * 1(1 + 00 * 1) * II) 0 * 1 * 1 + 11 * 0 * 1 III) (0 + 1) * 1 (I) and (III) represent DFA. (II) doesn't represent as the DFA accepts strings like 11011,but the regular expression doesn't accept. 47) There are 5 bags labelled 1 to 5. All the coins in a given bag have the same weight. Some bags have coins of weight 10 gm, others have coins of weight 11 gm. I pick 1, 2, 4, 8, 16 coins respectively from bags 1 to 5. Their total weight comes out to 323 gm. Then the product of the labels of the bags having 11 gm coins is. . . . . . . . . .
Answer: b Explanation: There are 5 bags numbered 1 to 5. We don't know how many bags contain 10 gm and 11 gm coins. We only know that the total weight of coins is 323. Now the idea here is to get 3 in the place of total sum's unit digit. Mark no 1 bag as having 11 gm coins.                                  Mark no 2 bag as having 10 gm coins.                                  Mark no 3 bag as having 11 gm coins.                                  Mark no 4 bag as having 11 gm coins.                                  Mark no 5 bag as having 10 gm coins.                                  Note: The above marking is done after getting false results for some different permutations, the permutations which were giving 3 in the unit place of the total sum. Now, we have picked 1, 2, 4, 8, 16 coins respectively from bags 1 to 5. Hence total sum coming from each bag from 1 to 5 is 11,20, 44, 88, 160 gm respectively. For the above combination we are getting 3 as unit digit in sum. Let's find out the total sum, it's 11 + 20 + 44 + 88 + 160 = 323. So it's coming right. Now 11 gm coins containing bags are 1, 3 and 4. Hence, the product is: 1 x 3 x 4 = 12. Alternative solution: There are bags with coins of weight 11g and 10g. The total weight of 1,2,4,8,16 coins picked from bags 1,2,3,4,5 is given as 323. Now we need to find no.of coins of 10g and 11g that give a sum of 323g. Let x be the no.of coins of weight 10g and y be the no.of coins of weight 11g Therefore 10x + 11y = 323. . . . . . . . . . . . . .1 Now we know the total no.of coins picked i.e. 1+2+4+8+16=31. Therefore x + y = 31. . . . . . . . . . . . . . . . .2 Solving equations 1 and 2 we get x=18, y=13. Therefore bags 2 and 5(2+16=x=18) have 10g coins and bags 1, 3 and 4(1+4+8=y=13) have 11g coins. Therefore the product of the labels of the bags having 11 gm coins is 1 x 3 x 4 = 12. 48) Suppose a polynomial time algorithm is discovered that correctly computes the largest clique in a given graph. In this scenario, which one of the following represents the correct Venn diagram of the complexity classes P, NP and NP Complete (NPC)?
Answer: d Explanation: Clique is an NP complete problem. If one NP complete problem can be solved in polynomial time, then all of them can be. So NPC set becomes equals to P. 49) The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is. . . . . . . . . .
Answer: a Explanation: Steps to find minimum and maximum element out of n numbers:
Therefore, we need 3 comparisons for each 2 elements, so total number of required comparisons will be (3n)/2  2, because we do not need to update min or max in the very first step. Recurrence relation will be: T(n) = T(⌈n/2⌉)+T(⌊n/2⌋)+2 = 2T(n/2)+2 = ⌈3n/2⌉2 By putting the value n=100, (3*100/2)2 = 148 which is answer. 50) Consider the following C function in which size is the number of elements in the array E: The value returned by the function MyX is the
Answer: a Explanation: The function does following Y is used to store maximum sum seen so far and Z is used to store current sum 1) Initialize Y as sum of all elements 2) For every element, calculate sum of all subarrays starting with arr[i]. Store the current sum in Z. If Z is greater than Y, then update Y. 51) Consider the following pseudo code. What is the total number of multiplications to be performed?
Answer: c Explanation: The statement "D = D * 3" is executed n*(n+1)*(n1)/6 times.                                          Let us see how. For i = 1, the multiplication statement is executed (n1) + (n2) + . . . . . . 2 + 1 times. For i = 2, the statement is executed (n2) + (n3) + . . . . . . . . . . . 2 + 1 times For i = n1, the statement is executed once. For i = n, the statement is not executed at all                                          So overall the statement is executed following times [(n1) + (n2) + . . . . . . . . . . . 2 + 1] + [(n2) + (n3) + . . . . . . . . . . . 2 + 1] + . . . . . . . . . . . .+ 1 + 0 The above series can be written as S = [n*(n1)/2 + (n1)*(n2)/2 +. . . . . . . . . . . + 1] The sum of above series can be obtained by trick of subtraction the series from standard Series S1 = n2 + (n1)2 + . . . . . . . . . . 12. The sum of this standard series is n*(n+1)*(2n+1)/6. S1  2S = n + (n1) +. . . . . . . . . . . 1 = n*(n+1)/2 2S = n*(n+1)*(2n+1)/6  n*(n+1)/2 S = n*(n+1)*(n1)/6 The above solution relies on a trick to obtain the sum of the series, but there is a much more straightforward way of obtaining the same result: For i = 1, the multiplication statement is executed (n1) + (n2) + .. 2 + 1 times. For i = 2, the statement is executed (n2) + (n3) + . . . . . . . . . ..2 + 1 times Therefore, for each i, the number of times the statement executed is: This is the sum of n natural numbers from 1 to n  i. Therefore, it can be simplified to:                                          Multiplying, we will get the following: Now, this is the number of times the statement will be executed for each i. Therefore, in total, the number of times the statement will be executed is:                                          Ignore the half for the moment. Expanding the summation is simple. You can distribute it across the expression to get this:                                          Using the formulae for sum of n natural numbers and the sum of squares of n natural numbers, we get:                                          Simplifying further and taking n/6 as a common term will give you: Now, take 2 as the common term and use it to cancel out the half that we ignored before. This gives you: Finally, using a^{2}b^{2}, you get the required answer: This should make the solution clear to you now! 52) Consider a hash table with 9 slots. The hash function is ?(k) = k mod 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are
Answer: a Explanation: Following are values of hash function for all keys 5 > 5 28 > 1 19 > 1 [Chained with 28] 15 > 6 20 > 2 33 > 6 [Chained with 15] 12 > 3 17 > 8 10 > 1 [Chained with 28 and 19] The maximum chain length is 3. The keys 28, 19 53) Consider a 6stage instruction pipeline, where all stages are perfectly balanced. Assume that there is no cycletime overhead of pipelining. When an application is executing on this 6stage pipeline, the speedup achieved with respect to nonpipelined execution if 25% of the instructions incur 2 pipeline stall cycles is
Answer: a Explanation: It was a numerical digit type question so answer must be 4. As for 6 stages, nonpipelining takes 6 cycles. There were 2 stall cycles for pipelining for 25% of the instructions So pipeline time = (1 + (25 / 100) * 2) = 1.5 Speed up = Non pipeline time/Pipeline time = 6 / 1.5 = 4 54) An access sequence of cache block address is of length N and contains n unique block addresses. The number of unique block addresses between two consecutive accesses to the same block address is bounded above by k. What is the miss ration is the access sequence is passed through a cache of associativity A >=k exercising leastrecently used replacement policy.
Answer: a Explanation: There are N access request for the cache blocks out this n blocks are unique. In between two access of the same block, there are request of (k1) other block, And if their associativity >=k and use LRU, then there will be only one cache miss for every unique block i.e., n and it will be the time when the enter the cache for the first time. Therefore Miss ratio =(Cache miss) / (No. of request) = n / N 55) Consider a 4  to1 multiplexer with two select lines S1 and S0, given below The minimal sumofproducts form of the Boolean expression for the output F of the multiplexer is
Answer: a Explanation: For 4 to 1 mux =p'q'(0)+p'q(1)+pq'r+pqr' =p'q+pq'r+pqr' =q(p'+pr')+pq'r =q(p'+r')+pq'r =p'q+qr'+pq'r Ans (a) 56) The function f(x) = x sinx satisfies the following equation f"(x) + f(x) + t cosx = 0. The value of t is
Answer: b Explanation: We have f(x) = x sin x ⇒ f'(x) = x cos x + sin x ⇒ f′′(x) = x (− sin x ) + cos x + cos x = (−x sin x ) + 2 cos x Now, it is given that f(x)=x sin x satisfies the equation f′′(x) + f(x) + t cos x = 0 ⇒ (−x sin x ) + 2 cos x + x sin x + t cos x = 0 ⇒ 2 cos x + t cos x = 0 ⇒ cos x ( t + 2 ) = 0 ⇒ t + 2 = 0 ⇒ t = −2 Thus, B is the correct option. 57) A function is continuous in the interval [0, 2]. It is known that f(0) = f(2) = 1 and f(1) = 1. Which one of the following statements must be true . . . . . . . . .?
Answer: a Explanation: Since the function is continuous, there must be point between 0 and 1 where it becomes 0 and there must also be a point between 1 and 2 where it becomes 0. 58) Four fair sixsided dice are rolled. The probability that the sum being 22 is X/1296. The value of X is. . . . . . . . . . . . . .
Answer: d Explanation: In general, Probability (of an event) = No of favourable outcomes to the event / Total number of possible outcomes in the random experiment. Here, 4 sixfaces dices are tossed, for one dice there can be 6 equally likely and mutually exclusive outcomes. Taking 4 together, there can be total number of 6*6*6*6 = 1296 possible outcomes. Now, Number of favourable cases to the event: here event is getting sum as 22. So, there can be only 2 cases possible. Case 1: Three 6's and one 4, for example: 6,6,6,4 (sum is 22) Hence, No of ways we can obtain this = 4!/3! = 4 ways ( 3! is for removing those cases where all three 6 are swapping among themselves)                                                Case 2: Two 6's and two 5's, for example: 6,6,5,5 (sum is 22) Hence, No of ways we can obtain this = 4!/( 2! * 2!) = 6 ways ( 2! is for removing those cases where both 6 are swapping between themselves, similarly for both 5 also) Hence total no of favourable cases = 4 + 6 = 10. Hence probability = 10/1296. Therefore option D. 59) A pennant is a sequence of numbers, each number being 1 or 2. An npennant is a sequence of numbers with sum equal to n. For example, (1,1,2) is a 4pennant. The set of all possible 1pennants is {(1)}, the set of all possible 2pennants is {(2), (1,1)} and the set of all 3pennants is {(2,1), (1,1,1), (1,2)}. Note that the pennant (1,2) is not the same as the pennant (2,1). The number of 10 pennants is             
Answer: a Explanation: 1  pennant {(1)}                   #1 2  pennant {(1, 1), (2)}               #2 3  pennant {(1, 1, 1), (1, 2), (2, 1)}            #3 4  pennant {(1, 1, 1, 1), (2, 2), (1, 1, 2), (1, 2, 1), (2, 1, 1)}              #5 5  pennant {(1, 1, 1, 1, 1), (2, 1, 1, 1), (1, 2, 1, 1), (1, 1, 2, 1 ), (1, 1, 1, 2), (2, 2, 1), (2, 1, 2),(1, 2, 2)}              #8 If one can observe carefully they are the terms (part of) a Fibonacci series. (0, 1, 1, 2, 3, 5, 8, 13 . . . . . . . . . . . . . Hence the # of 10pennant is the 12th term of the series i.e. 89 60) Let S denote the set of all functions f: {0,1}^{4} > {0,1}. Denote by N the number of functions from S to the set {0,1}. The value of Log_{2}Log_{2}N is . . . . . . . . . . . . . .
Answer: d Explanation: The given mapping S is defined by f:{0,1}^4 > {0,1} . So, number of functions from S will be 2^16. Now N is defined by f: S> {0,1}. So, Number of functions from S to {0,1} will be 2^S. Hence log_{2}log_{2}N = log_{2}S = 16 61) Consider an undirected graph G where selfloops are not allowed. The vertex set of G is {(i,j): 1 <= i<= 12, 1 <= j <= 12}. There is an edge between (a, b) and (c, d) if a  c <= 1 and b  d <= 1. The number of edges in this graph is. . . . . . . . . . . . . . . . . .
Answer: c Explanation: Given: The vertex set of G is {(i, j): 1 <= i<= 12, 1 <= j <= 12}. There is an edge between (a, b) and (c, d) if a  c <= 1 and b  d <= 1. There can be total 12*12 possible vertices. The vertices are (1, 1), (1, 2) . . . .. . . .(1, 12) (2, 1), (2, 2), . . . . . . . . . . . The number of edges in this graph? Number of edges is equal to number of pairs of vertices that satisfy above conditions. For example, vertex pair {(1, 1), (1, 2)} satisfy above condition. For (1, 1), there can be an edge to (1, 2), (2, 1), (2, 2). Note that there can be selfloop as mentioned in the question. Same is count for (12, 12), (1, 12) and (12, 1) For (1, 2), there can be an edge to (1, 1), (2, 1), (2, 2), (2, 3),(1, 3) Same is count for (1, 3), (1, 4). . . . . . . . . . .(1, 11), (12, 2), . . . . . . . . . . .(12, 11) For (2, 2), there can be an edge to (1, 1), (1, 2), (1, 3), (2, 1),(2, 3), (3, 1), (3, 2), (3, 3) Same is count for remaining vertices. For all pairs (i, j) there can total 8 vertices connected to them if i and j are not in {1, 12} There are total 100 vertices without a 1 or 12. So total 800 edges. For vertices with 1, total edges = (Edges where 1 is first part) + (Edges where 1 is second part and not first part) = (3 + 5 * 10 + 3) + (5 * 10) edges Same is count for vertices with 12 Total number of edges: = 800 + [(3 + 5 * 10 + 3) + 5 * 10] + [(3 + 5 * 10 + 3) + 5 * 10] = 800 + 106 + 106 = 1012 Since graph is undirected, two edges from v1 to v2 and v2 to v1 should be counted as one. So total number of undirected edges = 1012 / 2 = 506. 62) An ordered ntuple (d1, d2,. . . . . , dn) with d1 >= d2 >=. . . . . . . . .>= dn is called graphic if there exists a simple undirected graph with n vertices having degrees d1, d2, . . . . . . . ., dn respectively. Which of the following 6tuples is NOT graphic?
Answer: c Explanation: The required graph is not possible with the given degree set of (3, 3, 3, 1, 0, 0). Using this 6tuple, the graph formed will be a Disjoint undirected graph, where the two vertices of the graph should not be connected to any other vertex (i.e., degree will be 0 for both the vertices) of the graph. And for the remaining 4 vertices, the graph needs to satisfy the degrees of (3, 3, 3, 1). Let's see this with the help of a logical structure of the graph: Let's say vertices labelled should have their degree as <3, 3, 3, 1, 0, 0> respectively. Now E and F should not be connected to any vertex in the graph. And A, B, C and D should have their degree as <3, 3, 3, 1> respectively. Now to fulfil the requirement of A, B and C, the node D will never be able to get its degree as 1. Its degree will also become as 3. This is shown in the above diagram. Hence tuple <3, 3, 3, 1, 0, 0> is not graphic. 63) Which one of the following propositional logic formulas is TRUE when exactly two of p, q, and r are TRUE?
Answer: b Explanation: Draw the truth table of three variables and output will be 1 (true) only when exactly two variables are 1 (true) else output will be 0 (false). Therefore, p q r Output (f)                                           0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 0 f = ( ~p ∧ q ∧ r) ∨ (p ∧ ~q ∧ r) ∨ (p ∧ q ∧ ~r) f = {( ~p ∧ q ) ∨ (p ∧ ~q )} ∧ r ∨ (p ∧ q ∧ ~r) f = {(p ⊕ q )} ∧ r ∨ (p ∧ q ∧ ~r) f = {~ (p ↔ q )} ∧ r ∨ (p ∧ q ∧ ~r) Hence, option (b) is true. 64) Given the following schema: employees(empid, firstname, lastname, hiredate, deptid, salary) departments(deptid, deptname, managerid, locationid) You want to display the last names and hire dates of all latest hires in their respective departments in the location ID 1700. You issue the following query: What is the outcome?
Answer: b Explanation: The given query uses below inner query. SELECT deptid, MAX(hiredate)FROM employees JOIN departments USING(deptid)WHERE locationid = 1700GROUP BY deptid The inner query produces last max hiredate in every department located at location id 1700. The outer query simply picks all pairs of inner query. Therefore, the query produces correct result. SELECT lastname, hiredate FROM employeesWHERE (deptid, hiredate) IN(InnerQuery); 65) Consider two processors P1 and P2 executing the same instruction set. Assume that under identical conditions, for the same input, a program running on P2 takes 25% less time but incurs 20% more CPI (clock cycles per instruction) as compared to the program running on P1. If the clock frequency of P1 is 1GHz, then the clock frequency of P2 (in GHz) is . . . . . . . . . . . . . ..
Answer: a Explanation: For P1 clock period = 1ns Let clock period for P2 bet. Now consider following equation based on specification 7.5 ns = 12*t ns We get t and inverse of t will be 1.6GHz
Next TopicGATE 2013
