CS - 2013 - by WWW - Learnengineering.in
CS - 2013 - 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.
n
n g.i
GATE SOLVED PAPER
Computer Science Engineering
2013
e eri
gin
Copyright © By NODIA & COMPANY
En
arn
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
n
of the following statements is TRUE about 5?
(A) Commutative but not associative (B) Both commutative and associative
g.i
(C) Associative but not commutative (D) Neither commutative nor associative
Q. 2 Suppose p is the number of cars per minute passing through a certain road
n
junction between 5 PM and 6 PM, and p has a Poisson distribution with mean 3.
What is the probability of observing fewer than 3 cars during any given minute
in this interval?
(A) 8/ ^2e3h
(C) 17/ ^2e3h
e eri (B) 9/ ^2e3h
(D) 26/ ^2e3h
gin
1 x x2
Q. 3 Which one of the following does NOT equal 1 y y2 ?
1 z z2
x ^x 1+h x 1+ 1+ x2 1+
En
1 1 x
(A) 1 y ^y 1+h y 1+ (B) 1 y 1+ y2 1+
1 z ^z 1+h z 1+ 1 z 1+ z2 1+
0 x y- x2 y-2 2 x y+ x2 y+2
arn
form is
(A) –256 (B) –128
(C) –127 (D) 0
w
D0 D1 D2 D3 X0 X1 V
0 0 0 0 x x 0
1 0 0 0 0 0 1
x 1 0 0 0 1 1
x x 1 0 1 0 1
x x x 1 1 1 1
What function does the truth table represent?
(A) Priority encoder (B) Decoder
(C) Multiplexer (D) Demultiplexer
www.LearnEngineering.in
www.LearnEngineering.in
Q. 6 Which one of the following is the tightest upper bound that represents the number
of swaps required to sort n numbers using selection sort?
(A) O ^log n h (B) O ^n h
(C) O ^n log n h (D) O ^n2h
Q. 7 Which one of the following is the tightest upper bound that represents the time
complexity of inserting an object into a binary search tree of n nodes?
(A) O ^1 h (B) O ^log n h
(C) O ^n h (D) O ^n log n h
= and
F L2 "a , . Which one of the following represents
=
n
Q. 8 Consider the languages L1
L1 L*2 , L*1 ?
g.i
(A) " ,e (B) F
(C) a * (D) " , ae,
n
Q. 9 What is the maximum number of reduce moves that can be taken by a bottom-up
parser for a grammar with no epsilon- and unit-production (i.e., of type A " e
(A) n/2
(C) 2n 1-
e eri
and A " a ) to parse a string with n tokens?
(B) n 1-
(D) 2n
gin
Q. 10 A scheduling algorithm assigns priority proportional to the waiting time of a
process. Every process starts with priority zero (the lowest priority). The scheduler
re-evaluates the process priorities every T time units and decides the next process
to schedule. Which one of the following is TRUE if the processes have no I/O
En
GROUP II.
GROUP I GROUP II
(P) Service oriented computing (1) Interoperability
w
Q. 12 The transport layer protocols used for real time multimedia, file transfer, DNS
and email, respectively are
(A) TCP, UDP, UDP and TCP
(B) UDP, TCP, TCP and UDP
(C) UDP, TCP, UDP and TCP
(D) TCP, UDP, TCP and UDP
www.LearnEngineering.in
www.LearnEngineering.in
Q. 13 Using public key cryptography, X adds a digital signature M , encrypts M, s < >
, and sends it to Y , where it is decrypted. Which one of the following sequences
of keys is used for the operations?
(A) Encryption: X ’s private key followed by Y ’s private key; Decryption: X ’s
public key followed by Y ’s public key
(B) Encryption: X ’s private key followed by Y ’s public key; Decryption: X ’s
public key followed by Y ’s private key
(C) Encryption: X ’s public key followed by Y ’s private key; Decryption: Y ’s
public key followed by X ’s private key
(D) Encryption: X ’s private key followed by Y ’s public key; Decryption: Y ’s
n
private key followed by X ’s public key
g.i
Q. 14 Assume that source S and destination D are connected through two intermediate
n
routers labeled R. Determine how many times each packet has to visit the network
layer and the data link layer during a transmission from S to D .
e eri
(A) Network layer – 4 times and Data link layer – 4 times
gin
(B) Network layer – 4 times and Data link layer – 3 times
(C) Network layer – 4 times and Data link layer – 6 times
(D) Network layer – 2 times and Data link layer – 6 times
En
Q. 15 An index is clustered, if
(A) it is on a set of fields that form a candidate key.
arn
Q. 16 Three concurrent processes X , Y , and Z execute three different code segments that
w
access and update certain shared variables. Process X executes the P operation
(i.e., wait) on semaphores a , b and c ; process Y executes the P operation on
ww
www.LearnEngineering.in
www.LearnEngineering.in
n
Q. 18 Which of the following statements are TRUE?
g.i
1. The problem of determining whether there exists a cycle in an undirected
graph is in P .
2. The problem of determining whether there exists a cycle in an undirected
n
graph is in NP .
eri
3. If a problem A is NP -Complete, there exists a non-deterministic
polynomial time algorithm to solve A.
(A) 1, 2 and 3 (B) 1 and 2 only
e
(C) 2 and 3 only (D) 1 and 3 only
gin
Q. 19 What is the time complexity of Bellman-Ford single-source shortest path algorithm
on a complete graph of n vertices?
(A) ^Q n 2h (B) ^Q n2 log n h
(C) ^Q n 3h (D) ^Q n3 log n h
En
Q. 20 In a k -way set associative cache, the cache is divided into v sets, each of which
consists of k lines. The lines of a set are placed in sequence one after another.
The lines in set s are sequenced before the lines in set ^s 1+h. The main memory
arn
blocks are numbered 0 onwards. The main memory block mumbered j must be
mapped to any one of the cache lines from
(A) ^ j mod v h * k to ^ j mod v h * k ^k +1h -
.Le
Q. 21 Which one of the following expressions does NOT represent exclusive NOR of x
and y ?
ww
www.LearnEngineering.in
www.LearnEngineering.in
n
of unordered cycles of length three?
g.i
(A) 1/8 (B) 1
(C) 7 (D) 8
n
Q. 25 Which of the following statements is/are TRUE for undirected graphs?
P: Number of odd degree vertices is even
* For any two edges e and e ' in G , L ^G h has an edge between v ^e h and v ^e 'h,
if and only if e and e ' are incident with the same vertex in G .
arn
www.LearnEngineering.in
www.LearnEngineering.in
Q. 29 Consider a hard disk with 16 recording surfaces (0-15) having 16384 cylinders
(0-16383) and each cylinder contains 64 sectors (0-63). Data storage capacity
in each sector is 512 bytes. Data are organized cylinder-wise and the addressing
format is <cylinder no., surface no., sector no.>. A file of size 42797 KB is stored
in the disk and the starting disk location of the file is <1200, 9, 40>. What is
the cylinder number of the last sector of the file, if it is stored in a contiguous
manner?
(A) 1281 (B) 1282
(C) 1283 (D) 1284
^Q
log n h time using heap sort is
n
Q. 30 The number of elements that can be sorted in
^Q1h ^Q log n h
g.i
(A) (B)
log n
(C) cQloglog n m (D) ^Q
log n h
n
Q. 31 Consider the following function:
eri
int unknown (int n){
int i, j, k=0;
for (i=n/2; i<=n; i++)
for (j=2; j<=n; j=j*2)
e
k = k + n/2;
gin
return (k);
}
The return value of the function is
(A) ^Qn 2h (B) ^Q
n2 log n h
En
L1 $0 p 1q 0r p, q, r $ 0.
L2 $0 p 1q 0r p, q, r $ 0, p Y= r . =
Which one of the following statements is FALSE?
.Le
(A) L2 is context-free
(B) L1 + L2 is context-free
(C) Complement of L2 is recursive
w
www.LearnEngineering.in
www.LearnEngineering.in
1. Complement of L ^Ah
2. L ^Ah L ^^11 * 0 =0h^0 1h * 0 * 1 *h + +
3. For the language accepted by A, A is the minimal DFA.
4. A accepts all strings over "0, 1, of length at least 2.
(A) 1 and 3 only (B) 2 and 4 only
(C) 2 and 3 only (D) 3 and 4 only
n
Y and Z reads x from memory, decrements by two, stores it to memory, and
g.i
then terminates. Each process before reading x invokes the P operation (i.e.,
wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the
semaphore S after storing x to memory. Semaphore S is initialized to two. What
n
is the maximum possible value of x after all processes complete execution?
(A) –2 (B) –1
Q. 35
(C) 1
eri
Consider the following relational schema.
e (D) 2
numbered 107”
(I) SELECT DISTINCT S.sname
FROM Students as S, Registration as R
WHERE R.rollno=S.rollno AND R.courseno=107 AND R.percent>90
arn
(II) P _ courseno
sname s > ^Registration A Studentshi
= / percent 90
107
Q. 36 Determine the maximum length of the cable (in km) for transmitting data at a
ww
rate of 500 Mbps in an Ethernet LAN with frames of size 10000 bits. Assume the
signal speed in the cable to be 200000 km/s .
(A) 1 (B) 2
(C) 2.5 (D) 5
Q. 37 In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total
length is 400 and the fragment offset value is 300. The position of the datagram,
the sequence numbers of the first and the last bytes of the payload, respectively
are
(A) Last fragment, 2400 and 2789 (B) First fragment, 2400 and 2759
(C) Last fragment, 2400 and 2759 (D) Middle fragment, 300 and 689
www.LearnEngineering.in
www.LearnEngineering.in
Q. 38 The following figure represents access graphs of two modules M1 and M2. The
filled circles represent methods and the unfilled circles represent attributes. If
method m is moved to module M2 keeping the attributes where they are, what
can we say about the average cohesion and coupling between modules in the
system of two modules?
n
g.i
(A) There is no change.
(B) Average cohesion goes up but coupling is reduced.
n
(C) Average cohesion goes down and coupling also reduces.
Q. 39
for 0 < i < n and b 6i @ =
eri
(D) Average cohesion and coupling increase.
private i; private i;
for (i=0; i<n; i++) { for (i=0; i<n; i++){
a[i] = f(i); EntryY(R, S);
arn
and EntryY?
(A) ExitX(R, S) {
P(R);
V(S);
w
}
EntryY(R, S){
ww
P(S);
V(R);
}
(B) ExitX(R, S) {
V(R);
V(S);
}
EntryY(R, S){
P(R);
P(S);
}
www.LearnEngineering.in
www.LearnEngineering.in
n
P(S);
}
g.i
EntryY(R, S){
V(S);
P(R);
n
}
eri
Q. 40 Consider the following two sets of LR(1) items of an LR(1) grammar.
X " c.X, c/d X " c.X, S
X " .cX, c/d X " .cX, S
e
X " .d, c/d X " .d, S
gin
Which of the following statements related to merging of the two sets in the
corresponding LALR parser is/are FALSE?
1. Cannot be merged since look aheads are different.
2. Can be merged but will result in S-R conflict.
En
2. G is a CFG. Is L ^G h = *S?
3. M is a Turing machine, Is L ^M h regular?
4. A is a DFA and N is an NFA. Is L ^Ah = L ^N h?
w
www.LearnEngineering.in
www.LearnEngineering.in
Q. 43 The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23,
39, 35, 42. Which one of the following is the postorder traversal sequence of the
same tree?
(A) 10, 20, 15, 23, 25, 35, 42, 39, 30
(B) 15, 10, 25, 23, 20, 42, 35, 39, 30
(C) 15, 20, 10, 23, 25, 42, 35, 39, 30
(D) 15, 10, 23, 25, 20, 35, 42, 39, 30
Q. 44 Consider the following operation along with Enqueue and Dequeue operations
on queues, where k is a global parameter.
n
MultiDequeue(Q){
g.i
m = k
while (Q is not empty) and (m > 0){
Dequeue(Q)
n
m = m - 1
}
eri
}
What is the worst case time complexity of a sequence of n queue operations on
an initially empty queue?
(A) ^Q nh
e
(B) ^Q n k+h
gin
(C) ^Q nk h
(D) ^Q n 2h
En
Q. 45 Consider an instruction pipeline with five stages without any branch prediction:
Fetch Instruction (FI), Decode Instruction (DI), Fetch Operand (FO), Execute
Instruction (EI) and Write Operand (WO). The stage delays for FI, DI, FO, EI
and WO are 5 ns , 7 ns , 10 ns , 8 ns and 6 ns , respectively. There are intermediate
arn
storage buffers after each stage and the delay of each buffer is 1 ns . A program
consisting of 12 instructions I1 , I2 , I 3 , ..., I12 is executed in this pipelined processor.
Instruction I 4 is the only branch instruction and its branch target is I 9 . If the
branch is taken during the execution of this program, the time (in ns) needed to
.Le
Q. 46 A RAM chip has a capacity of 1024 words of 8 bits each ^1K # 8h. The number
of 2 # 4 decoders with enable line needed to construct a 16 K # 16 RAM from
ww
1 K # 8 RAM is
(A) 4 (B) 5
(C) 6 (D) 7
Q. 47 Which one of the following is NOT logically equivalent to J7x ^6y ^ h / 6z ^ ahh b
(A) 6x ^7z ^J h " 6y ^ bhh a
(B) 6x ^6z ^ h " 7y ^J bhh a
(C) 6x ^6y ^ h " 7z ^J ahh b
(D) 6x ^7y ^J h " 7z ^J ahh b
www.LearnEngineering.in
www.LearnEngineering.in
n
x = c * c;
g.i
if (x > a){
y = a * a;
}
n
else {
d = d * d;
eri
e = e * e;
}
Q. 48 Suppose the instruction set architecture of the processor has only two registers.
e
The only allowed compiler optimization is code motion, which moves statements
gin
from one place to another while preserving correctness. What is the minimum
number of spills to memory in the compiled code?
(A) 0 (B) 1
(C) 2 (D) 3
En
Q. 49 What is the minimum number of registers needed in the instruction set architecture
of the processor to compile this code segment without any spill to memory? Do
not apply any optimization other than optimizing register allocation.
arn
(A) 3 (B) 4
(C) 5 (D) 6
.Le
array oldc, while their respective replacement characters are supplied in array newc.
Array A has a fixed length of five characters, while arrays oldc and newc contain three
ww
www.LearnEngineering.in
www.LearnEngineering.in
Q. 50 The tester now tests the program on all input strings of length five consisting
of characters ‘a’, ‘b’, ‘c’ and ‘e’ with duplicates allowed. If the tester
carries out this testing with the four test cases given above, how many test case
will be able to capture the flaw?
(A) Only one (B) Only two
(C) Only three (D) All four
Q. 51 If array A is made to hold the string “abcde”, which of the above four sest cases
will be successful in exposing the flaw in this procedure?
(A) None (B) 2 only
n
(C) 3 and 4 only (D) 4 only
g.i
Linked Answer Questions
n
Statement For Linked Q. 52 and 53 :
eri
A computer uses 46-bit virtual address, 32-bit physical address, and a three-level paged
page table organization. The page table base register stores the base address of the
first-level table ^T1h, which occupies exactly one page. Each entry of T1 stores the base
e
address of a page of the second-level table ^T2h. Each entry of T2 stores the base address
gin
of a pae of the third-level table ^T3h. Each entry of T3 stores a page table entry (PTE).
The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16-way set
associative virtually indexed physically tagged cache. The cache block size is 64 bytes.
En
Q. 53 What is the minimum number of page colours needed to guarantee that no two
synonyms map to different sets in the processor cache of this computer?
(A) 2 (B) 4
.Le
(C) 8 (D) 16
Relation R has eight attributes ABCDEFGH . Fields of R contain only atomic values.
F = "CH " G, A " BC, B " CFG, E " A, F " EG , is a set of functional dependencies
ww
(FDs) so that F +is exactly the set of FDs that hold for R.
Q. 54 How many candidate keys does the relation R have?
(A) 3 (B) 4
(C) 5 (D) 6
Q. 55 The relation R is
(A) in 1 NF , but not in 2 NF
(B) in 2 NF , but not in 3 NF
(C) in 3 NF , but not in BCNF
(D) in BCNF
www.LearnEngineering.in
www.LearnEngineering.in
n
(C) Medium
g.i
(D) Integration
n
(A) specificity
eri
(B) neutrality
(C) generality
(D) adaptation
e
Q. 58 What will be the maximum sum of 44, 42, 40, ....?
gin
(A) 502 (B) 504
(C) 506 (D) 500
1 + 1 + 1 ... + 1 +
1 +2 2 +3 3 +4 80 +81
(A) 7 (B) 8
(C) 9 (D) 10
Q. 62 Out of all the 2-digit integers between 1 and 100, a 2-digit number has to be
selected at random. What is the probability that the selected number is not
divisible by 7?
(A) 13/90 (B) 12/90
(C) 78/90 (D) 77/90
www.LearnEngineering.in
www.LearnEngineering.in
Q. 63 After several defeats in wars, Robert Bruce went in exile and wanted to commit
suicide. Just before committing suicide, he came across a spider attempting
tirelessly to have its net. Time and again, the spider failed but that did not deter
it to refrain from making attempts. Such attempts by the spider made Bruce
curious. Thus, Bruce started observing the near-impossible goal of the spider to
have the net. Ultimately, the spider succeeded in having its net despite several
failures. Such act of the spider encouraged Bruce not to commit suicide. And
then, Bruce went back again and won many a battle, and the rest is history.
Which one of the following assertions is best supported by the above information?
(A) Failure is the pillar of success
n
(B) Honesty is the best policy
g.i
(C) Life begins and ends with adventures
(D) No adversity justifies giving up hope
Q. 64 A tourist covers half of his journey by train at 60 km/h , half of the remainder
n
by bus at 30 km/h and the rest by cycle at 10 km/h . The average speed of the
eri
tourist in km/h during his entire journey is
(A) 36 (B) 30
(C) 24 (D) 18
e
Q. 65 The current erection cost of a structure is Rs 13200. If the labour wages per day
gin
increase by 1/5 of the current wages and the working hours decrease by 1/24 of
the current period, then the new cost of erection in Rs. is
(A) 16500 (B) 15180
En
**********
w .Le
ww
www.LearnEngineering.in
www.LearnEngineering.in
ANSWER KEY
2013
1 2 3 4 5 6 7 8 9 10
(A) (C) (A) (B) (A) (B) (C) (A) (C) (B)
11 12 13 14 15 16 17 18 19 20
(C) (C) (D) (C) (C) (B) (C) (A) (C) (B)
21 22 23 24 25 26 27 28 29 30
(D) (A) (D) (C) (C) (B) (D) (D) (D) (A)
n
31 32 33 34 35 36 37 38 39 40
g.i
(B) (D) (D) (D) (A) (B) (C) (B) (B) (D)
41 42 43 44 45 46 47 48 49 50
(D) (B) (D) (C) (C) (B) (A) (C) (B) (B)
n
51 52 53 54 55 56 57 58 59 60
(C)
61
(B)
(B)
62
(D)
(*)
63
(D)
(B)
64
(C)
(A)
65
(B)
e eri
(B) (A) (C) (A) (C)
gin
En
arn
w .Le
ww
www.LearnEngineering.in