CS - 2015 2 by WWW - Learnengineering.in
CS - 2015 2 by WWW - Learnengineering.in
in
No part of this publication may be reproduced or distributed in any form or any means, electronic, mechanical,
photocopying, or otherwise without the prior permission of the author.
.in
ng
GATE SOLVED PAPER
eri
Computer Science & IT
e
2015-2
gin
Information contained in this book has been obtained by authors, from sources believes to be reliable. However,
neither Nodia nor its authors guarantee the accuracy or completeness of any information herein, and Nodia nor its
authors shall be responsible for any error, omissions, or damages arising out of use of this information. This book
is published with the understanding that Nodia and its authors are supplying information but are not attempting
Le
www.LearnEngineering.in
www.LearnEngineering.in
General Aptitude
.in
Q. 1 Based on the given statements, select the most appropriate option to solve the
given question
ng
What will be the total weight of 10 poles each of same weight?
Statements
(I) One fourth of the weight of a pole is 15 kg.
poles
e eri
(II) The total weight of these poles is 160 kg more than the total weight of two
Q. 3 A generic term that include various items of clothing such as a skirt, a pair of
trousers and a shirt is
Le
(A) fabric
(B) textile
(C) fibre
w.
(D) apparel
.in
(q r+) qr
ng
(A) (B)
qr (q r+)
(q r+) 2
(C) (q2 r+2) (D)
qr
Q. 7
(A) Since the report lacked needed information, it was of no use to them.
e
(B) The report was useless to them because there were no needed information in
gin
it.
(C) Since the report did not contain the needed information, it was not real
useful to them
En
(D) Since the report lacked needed information, it would not had been useful to
them.
arn
III. P2 , R2 , S 2 , T 2 , U 2
(A) I only (B) I and II
w.
f (p, q, r, s) =
max (p, q, r, s)
g (p, q, r, s) =min (p, q, r, s)
remainder of ((pr #
h (p, q, r, s) = # q)
s) if (p # q) (r # s) or remainder of ((pr #
> s)
# q)
if (r # s) > (p # q)
Also a function fgh (p, q, r, s) =f (p, q, r, s) # g (p, q, r, s) # h (p, q, r, s)
Also the same operations are valid with two variable functions of the form (p, q)
What is the value of fg (h (2, 5, 7, 3), 4, 6, 8)?
Q. 10 Four branches of a company are located at M, N, O and P, M is north of N at a
distance of 4 km: P is south of O at a distance of 2 km: N is southeast of O by 1
km. What is the distance between M and P in km?
(A) 5.34 (B) 6.74
(C) 28.5 (D) 45.49
Q. 2 Let R be the relation on the set of positive integers such that a aRb if and only if
.in
a and b are distinct and have a common divisor other than 1. Which one of the
following statements about R is true?
(A) R is symmetric and reflexive but not transitive
ng
(B) R is reflexive but not symmetric and not transitive
(C) R is transitive but not reflexive and not symmetric
(D) R is symmetric but not reflexive and not transitive
eri
Q. 3 Consider the following transaction involving two bank account x and y .
read (x ); x : = x − 50 ; write (x ); read (y ); y : = y + 50 ; write (y )
e
The constraint that the sum of the accounts x and y should remain constant is
gin
that of
(A) Atomicity (B) Consistency
(C) Isolation (D) Durability
En
Q. 4 A binary tree T has 20 leaves. The number of nodes in T having two children
is_______.
Q. 5 Consider the basic COCOMO model where E is the effort applied in person-
arn
Q. 8 A system has 6 identical resources and N processes competing for them. each
process can request atmost 2 resources. Which one of the following values of N
could lead to a deadlock?
(A) 1 (B) 2
(C) 3 (D) 4
Q. 9 Consider a complete binary tree where the left and the right subtrees of the root
are max-heaps. The lower bound for the number of operations to convert the tree
to a heap is
(A) Ω (log n) (B) Ω (n)
(C) Ω (n log n) (D) Ω (n2)
.in
Q. 10 In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG),
which one of the following is TRUE?
ng
(A) In both AST and CFG, let node, N2 be the successor of node N1 . In the input
program, the code corresponding to N2 is present after the code corresponding
in N1 .
eri
(B) For any input program, neither AST nor CFG will contain a cycle
(C) The maximum number of successors of a node in an AST and a CFG depends
on the input program
e
(D) Each node is AST and CFG corresponds to at most one statement in the
gin
input program
Q. 11 With reference to the B +tree index of order 1 shown below, the minimum
number of nodes (including the Root node) that must be fetched in order to
En
satisfy the following query: “Get all records with a search key greater than or
equal to 7 and less than 15” is_______
arn
Le
w.
Q. 13 Identify the correct order in which a server process must invoke the function calls
accept, bind, listen, and recv according to UNIX socket APL
(A) listen, accept, bind recv (B) bind, listen, accept, recv
(C) bind, accept, listen, recv (D) accept, listen, bind recv
4 5
Q. 14 The larger of the two eigen values of the matrix > H is_______
2 1
.in
site
ng
void foo(char*a){
if(*a &&*a!=‘ ‘){
putchar (*a);
}
} eri
The output of the above function on input “ABCD EFGH” is
e
(A) ABCD EFGH
(B)
(D) ABCD
gin
Q. 18 A link has a transmission speed of 106 bits/sec. It uses data packets of size 1000
bytes each. Assume that the acknowledgement has negligible transmission delay,
En
and that its propagation delay is the same as the data propagation delay. Also
assume that the processing delays at the nodes are negligible. The efficiency of
the stop-and-wait protocol in this setup is exactly 25%. The value of the one-way
propagation delay (in milliseconds) is_______.
arn
.in
}
The return value of fun (5) is ______
ng
Q. 24 Consider the following statements
I. The complement of every Turing decidable language in Turing decidable
II. There exists some language which is in NP but is not turing decidable
eri
III. If L is a language in NP, L is turing decidable
Which of the above statements is/are true?
e
(A) Only II (B) Only III
gin
(C) Every edge of a clique with size $ 3 is a bridge (A clique is any compete sub
graph of a graph)
w.
Q. 27 Consider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB< 300
KB and 250 KB, where KB refers to kilobyte. These partitions need to be allotted
ww
to four processes of sizes 357 KB, 210 KB, 468 KB and 491 KB in that order. If
the best fit algorithm is used, which partitions are NOT allotted to any process?
(A) 200 KB and 300 KB (B) 200 KB and 250 KB
(C) 250 KB and 300 KB (D) 300 KB and 400 KB
Q. 28 Which one of the following assertions concerning code inspection and code
walkthrough is true?
(A) Code inspection is carried out once the code has been unit tested
(B) Code inspection and code walkthrough are synonyms
(C) Adherence to coding standards is checked during code inspection
(D) Code walkthrough is usually carried out by an independent test team
Q. 29 Given below are some algorithms, and some algorithm design paradigms.
(1) Dijkstra’s Shortest Path (i) Divide and Conquer
(2) Floyd-Warshall algorithm to (ii) Dynamic Programming
compute all pair shortest path
(3) Binary search on a sorted array (iii) Greedy design
(4) Backtracking search on a graph (iv) Depth-first search
(v) Breadth-first search
Match the above algorithms on the left to the corresponding design paradigm
they follow.
.in
(A) 1-i, 2-iii, 3-i, 4-v
(B) 1-iii, 2-iii, 3-i, 4-v
(C) 1-iii, 2-ii, 3-i, 4-iv
ng
(D) 1-iii, 2-ii, 3-i, 4-v
Q. 30 Suppose you are provided with the following function declaration in the C
programming language
int partition (int a[], int n);
eri
The function treats the first element of a [ ] as a pivot, and rearranges the array
e
so that all elements less than or equal to the pivot is in the left part of the array,
gin
and all elements greater than the pivot is in the right part. In addition, it moves
the pivot so that the pivot is the last elements of the left part. The return value
is the number of elements in the left part.
The following partially given function in the C programming language is used to
En
find the Kth smallest element in an array a [ ] of size n using the partition function
We assume k # n.
int kth_smallest (int a[], int n, int k)
arn
{
int left_end = partition (a, n);
if(left_end+1==k){
return a[left_end];
Le
}
if(left_end+1>k){
return kth_smallest(__________);
w.
}else{
return kth_smallest(_____________);
}
ww
}
The missing argument lists are respectively
(A) (a, left_end, k) and (a+left_end +1, n – left_end –1, k – left_end –1)
(B) (a, left_end, k) and (a, n – left_end –1, k – left_end –1)
(C) (a+left_end+1, n – left end –1, k – left_end –1) and (a, left_end, k)
(D) (a, n – left_end –1, k – left_end –1) and (a, left_end, k)
Q. 31 Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has
a transfer rate of 50 # 106 bytes/sec. If the average seek time of the disk is twice
the average rotational delay and the controller’s transfer time is 10 times the disk
transfer time, the average time (in milliseconds) to read or write a 512-byte sector
of the disk is_______.
Let f (x) = x−b 3 l and A denote the area of the region bounded by f (x) and the
1
Q. 32
X -axis, when x varies from 1-to 1. Which of the following statements is/are
TRUE?
(I) f is continuous in [ 1-, 1]
(II) f is not bounded in [ 1-, 1]
(III) A is nonzero and finite
(A) II only (B) III only
(C) II and III only (D) I, II and III
.in
1. i = 1
2. j = 1
3. t1 = 5*i
ng
4. t2 = t1 + j
5. t3 = 4 * t2
6. t4 = t3
7. a [t4] =− 1
eri
8. j = j + 1
e
9. if j <= 5 goto (3)
gin
10. i = i + 1
11. if i < 5 goto (2)
The number of nodes and edges in the control-flow-graph constructed for the
En
(C) 5 and 5
(D) 7 and 8
Q. 34
is_______.
[Dl ABl +AlC AC lD++AlC lD]l +
w.
Q. 36 Consider the alphabet Σ = {0.1}, the null/empty string λ and the sets of strings
X 0 , X1 and X2 generated by the corresponding non-terminals of regular grammar.
X 0 , X1 and X2 are related as follows:
X0 = 1X1
X1 = 0X1 + 1X2
X2 = 0X1 + {λ}
Which one of the following choices precisely represents the strings in X 0 ?
(A) 10 (0 * (+10) *) 1
(B) 10 (0 * (+10) *) * 1
(C) 1 (0 10 +)*1
(D) 10 (0 10 *) * 1 +110 (0 10 +)*1 +
.in
Q. 38 Consider a processor with byte-addressable memory. Assume taht all registers,
including Program Counter (PC) and Program Status Word (PSW), are of size
2 bytes. A stack in the main memory is implemented from memory location
ng
(0100)16 and it grows upward. The stack pointer (SP) points to the top element
of the stack. The current value of SP is (016E )16. The CALL instruction is of two
words, the first word is the op-code and the second word is the starting address
of the subroutine. (one word =
follows:
eri
2 bytes). The CALL instruction implemented as
There is no option field in IP header How many total number of IP fragments will
be transmitted and what will be the contents of offset field in the last fragment?
(A) 6 and 95
w.
For each IP address in Group I identify the correct choice of the next hop from
Group II using the entries from the routing table above.
Group I Group II
(i) 128.96.171.92 (a) Interface 0
(ii) 128.96.167.151 (b) Interface 1
(iii) 128.96.163..151 (c) R2
(iv) 128.96.165.121 (d) R3
(e) R4
(A) i - a, ii - c, iii - e, iv - d (B) i - a, ii - d, iii - b, iv - e
.in
(C) i - b, ii - c, iii - d, iv - e (D) i - b, ii - c, iii - e, iv - d
Q. 42 Consider two relations R1 (A, B) with the tuples (1.5), (3, 7) and R2 ( A, C ) =
ng
(1.7), (4, 9). Assume that R (A, B, C) is the full natural outer join of R1 and R2
. Consider the following tuples of the form (A, B, C): a = (1.5, null), b = (1, null,
7), c = (3, null, 9), d = (4, 7, null), e = (1, 5, 7), f =
(3, 7, null), g = (4, null, 9).
eri
Which one of the following statements is correct?
(A) R contains a , b, e , f , g but not c , d
(B) R contains all of a , b, c , d , e , f , g
e
(C) R contains e , f , g but not a , b
gin
(Start, T4); (write, T4, y, 2,3); (Start, R1); (commit, T4); (write, T1, z,5,7)
(checkpoint);
(Start, T2); (write, T2, x, 1,9); (commit, T2); (start, T3), (write, T3, z, 7,2);
arn
If a crash happens now and the system tries to recover using both undo and redo
operations, what are the contents of the undo lists and the redo list?
(A) Undo T3, T1; Redo T2
Le
bits, and the translation. If the maximum size of the page table of a process
is 24 megabytes, the length of the virtual address supported by the system is
_______ bits.
Q. 45 Which one of the following hash functions on integers will distribute keys most
uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?
(A) h (i) =i2 mod 10
(B) h (i) =i3 mod 10
(C) h (i) =(11 * i2) mod 10
(D) h (i) =(12 * i) mod 10
Q. 46 Assume that the bandwidth for a TCP connection is 1048560 bits/sec. Let α be
the value of RTT in milliseconds. (rounded off to the nearest integer) after which
the TCP window scale option is needed. Let β be the maximum possible window
size the window scale option. Then the values of α and β are
(A) 63 milliseconds, 65535#214 (B) 63 milliseconds, 65535#216
(C) 500 milliseconds, 65535#214 (D) 500 milliseconds, 65535#216
Q. 47 A young tableau is a 2D array of integers increasing from left to right and from
top to bottom. Any unfilled entries are marked with 3, and hence there cannot
be any entry to the right of, or below a 3. The following Young tableau consists
of unique entries.
.in
1 2 5 14
3 4 6 23
ng
10 12 18 25
31 3 3 3
When an element is removed from a Young tableau, other elements should be
eri
moved into its place so that the resulting table is still a Young tableau (unfilled
entries may be filled in with a 3). The minimum number of entries (other than
1) to be shifted, to remove 1 from the given Young tableau is _______
e
Q. 48 A half adder is implemented with XOR and AND gates. A full adder is implemented
gin
with two half adders and one OR gate. The propagation delay of an XOR gate
is twice that of an AND/OR gate. The propagation delay of an AND/OR gate is
1.2 microseconds. A 4-bit ripple-carry binary adder is implemented by using four
En
full adders. The total propagation time of this 4-bit binary adder in microseconds
is _______.
Q. 49 Consider the sequence of machine instruction give below:
arn
Write back the result (WB). The IF, OF and WB stages take 1 clock cycle each
for any instruction The PO stage takes 1 clock cycle for ADD or SUB instruction,
3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The
pipelined processor uses operand forwarding from the PO stage to the OF stage.
The number of clock cycles taken for the execution of the above sequence of
instructions is_______.
R 3 4 45 V
S W
Q. 50 Perform the following operations on the matrix S 7 9 105W .
S13 2 195W
(i) Add the third row to the second row T X
(ii) Subtract the third column from the first column
The determinant of the resultant matrix is _______.
.in
(C) Odd
(D) Congruent to 0 mod 4, or, 1 mod 4
ng
Q. 53 The secant method is used to find the root of an equation f (x) =. 0 It is started
from two distinct estimates, xa and xb for the root. It is an iterative procedure
involving linear interpolation to a root. The iteration stops if f (xb) is very small
eri
and then xb is the solution. The procedure is given below. Observe that there is
an expression which is missing and is marked by? Which is the suitable expression
that is to be put in place of ? so that it follows all steps of the secant method?
e
Secant
Initialize: xa ,xb ,ε ,N //ε =convergence indicator
gin
//reset xa
fb = f (xb) //function value at new xb
Le
end while
if f b > ε then //loop is terminated with i =
N
write “Non-convergence”
w.
else
Write “Non-convergence”
Else
ww
Write “return xb ”
End if
(A) x b (-f b f (x a)) f b / (xb -xa) -
(B) xa (f b -f (xa)) f a / (-xb x-a)
(C) xb (xb -xa) f b / (f b -f-(xa))
(D) xa (xb -xa) f a / (f b -f-(xa))
Q. 54 Let X and Y denote the sets containing 2 and 20 distinct objects respectively
and F denote the set of all possible functions defined from X to Y . Let f be
randomly chosen from F . The probability of f being one-to-one is_______.
.in
return-1;
}
int main()
ng
{
int B[20]; A=B; stkTop=–1;
stkFunc(–1, 10);
stkFunc(0, 5);
stkFunc(0, 10);
eri
print f(“%d\n”, stkFunc(1, 0)+stkfunc(1, 0);
e
}
gin
ANSWER KEY
General Aptitude
1 2 3 4 5 6 7 8 9 10
(C) (C) (D) (C) (C) (B) (A) (B) (8) (A)
.in
11 12 13 14 15 16 17 18 19 20
(5) (C) (B) (6) (2048) (A) (D) (12) (3) (C)
21 22 23 24 25 26 27 28 29 30
ng
(A) (22) (51) (D) (36) (B) (A) (C) (C) (A)
31 32 33 34 35 36 37 38 39 40
(6.1)
41
(C)
42
(B)
43
(1)
44
(36)
45
e
46
eri
(C) (A)
47
(D)
48
(3)
49
(C)
50
(A) (C) (A) (36) (B) (C) (5) (19.2) (13) (0)
gin
51 52 53 54 55
(C) (D) (C) (0.95) (15)
En
arn
Le
w.
ww