This action might not be possible to undo. Are you sure you want to continue?
com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 1 of 20
Q.1 – Q.20 Carry One Mark Each
1.
x
x sinx
lim equals
x cos x
→∞
−
+
(A) 1 (B) 1 (C) ∞ (D) −∞
2. If P, Q, R are subsets of the universal set U, then
( ) ( )
c c c
P Q R P Q R Q R ∩ ∩ ∪ ∩ ∩ ∪ ∪ is
(A)
c c
Q R ∪ (B)
c c
P Q R ∪ ∪ (C)
c c c
P Q R ∪ ∪ (D) U
3. The following system of equations
1 2 3
1 2 3
1 2 3
x x 2x 1
x 2x 3x 2
x 4x x 4
+ + =
+ + =
+ + α =
has a unique solution. The only possible value(s) for α is/are
(A) 0 (B) either 0 or 1
(C) one of 0, 1 or 1 (D) any real number
4. In the IEEE floating point representation the hexadecimal value 0x00000000
corresponds to
(A) The normalized value 2
127
(B) The normalized value 2
126
(C) The normalized value +0 (D) The special value +0
5. In the Karnaugh map shown below, X denotes a don’t care term. What is the
minimal form of the function represented by the Karnaugh map?
(A) b.d a.d + (B) a.b b.d a.b.d + + (C) b.d a.b.d + (D) a.b b.d a.d + +
6. Let r denote number system radix. The only value(s) of r that satisfy the
equation
r r
121 11 is / are =
(A) decimal 10 (B) decimal 11
(C) decimal 10 and 11 (D) any value >2
1 1 1
X
X
1 X 1
00 01 10 11
ab
cd
00
01
11
10
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 2 of 20
7. The most efficient algorithm for finding the number of connected components in
an undirected graph on n vertices and m edges has time complexity
(A) ( ) n Θ (B) ( ) m Θ (C) ( ) m n Θ + (D) ( ) mn Θ
8. Given f
1
, f
3
and f in canonical sum of products form (in decimal) for the circuit
( )
( )
( )
1
3
2
f m 4,5, 6,7, 8
f m 1, 6,15
f m 1, 6, 8,15
then f is
= Σ
= Σ
= Σ
(A) ( ) m 4, 6 Σ (B) ( ) m 4, 8 Σ (C) ( ) m 6, 8 Σ (D) ( ) m 4, 6, 8 Σ
9. Which of the following is true for the language
{ }
p
a p is a prime ?
(A) It is not accepted by a Turing Machine
(B) It is regular but not contextfree
(C) It is contextfree but not regular
(D) It is neither regular nor contextfree, but accepted by a Turing machine
10. Which of the following are decidable?
I. Whether the intersection of two regular languages is infinite
II. Whether a given contextfree language is regular
III. Whether two pushdown automata accept the same language
IV. Whether a given grammar is contextfree
(A) I and II (B) I and IV (C) II and III (D)II and IV
11. Which of the following describes a handle (as applicable to LRparsing)
appropriately?
(A) It is the position in a sentential form where the next shift or reduce operation
will occur
(B) It is nonterminal whose production will be used for reduction in the next
step
(C) It is a production that may be used for reduction in a future step along with a
position in the sentential form where the next shift or reduce operation will
occur
(D) It is the production p that will be used for reduction in the next step along
with a position in the sentential form where the right hand side of the
production may be found
f 2
f
1
f
3
f
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 3 of 20
12. Some code optimizations are carried out on the intermediate code because
(A) They enhance the portability of the compiler to other target processors
(B) Program analysis is more accurate on intermediate code than on machine
code
(C) The information from dataflow analysis cannot otherwise be used for
optimization
(D) The information from the front end cannot otherwise be used for optimization
13. If L and L are recursively enumerable then L is
(A) regular (B) contextfree
(C) contextsensitive (D) recursive
14. What is the maximum size of data that the application layer can pass on to the
TCP layer below?
(A) Any size (B) 2
16
bytessize of TCP header
(C) 2
16
bytes (D) 1500 bytes
15. Which of the following tuple relational calculus expression(s) is/are equivalent to
( ) ( )
t r P t ? ∀ ∈
( ) ( )
( ) ( )
( ) ( )
( ) ( )
I. t r P t
II. t r P t
III. t r P t
IV. t r P t
¬∃ ∈
∃ ∉
¬∃ ∈ ¬
∃ ∉ ¬
(A) I only (B) II only
(C) III only (D) III and IV only
16. A clustering index is defined on the fields which are of type
(A) nonkey and ordering (B) nonkey and nonordering
(C) key and ordering (D) key and nonordering
17. Which of the following system calls results in the sending of SYN packets?
(A) socket (B) bind (C) listen (D) connect
18. Which combination of the integer variables x, y and z makes the variable a get
the value 4 in the following expression?
( ) ( ) ( ) ( ) ( )
a x y ? x z ?x : z : y z ?y : z = > > >
(A) x 3, y 4, z 2 = = = (B) x 6, y 5, z 3 = = =
(C) x 6, y 3, z 5 = = = (D) x 5, y 4, z 5 = = =
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 4 of 20
19. The Breadth First Search algorithm has been implemented using the queue data
structure. One possible order of visiting the nodes of the following graph is
(A) MNOPQR (B) NQMPOR (C) QMNPRO (D) QMNPOR
20. The data blocks of a very large file in the Unix file system are allocated using
(A) contiguous allocation
(B) linked allocation
(C) indexed allocation
(D) an extension of indexed allocation
Q.21 – Q.75 Carry Two Marks Each
21. The minimum number of equal length subintervals needed to approximate
2
x 6
1
1
xe dx to an accuracy of at least 10 using the trapezoidal rule is
3
−
×
∫
(A) 1000e (B) 1000 (C) 100e (D) 100
22. The NewtonRaphson iteration
n 1 n
n
1 R
x x
2 x
+
 
= +

\ ¹
can be used to compute the
(A) square of R (B) reciprocal of R
(C) square root of R (D) logarithm of R
23. Which of the following statements is true for every planar graph on n vertices?
(A) The graph is connected
(B) The graph is Eulerian
(C) The graph has a vertexcover of size at most 3n/4
(D) The graph has an independent set of size at least n/3
24.
1 i 2k 1 i 2k
i odd i even
Let P i and Q i, where k is a positive integer. Then
≤ ≤ ≤ ≤
= =
∑ ∑
(A) P Q K = − (B) P Q K = + (C) P = Q (D) P Q 2K = +
M N O
R Q P
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 5 of 20
25. A point on a curve is said to be an extremum if it is a local minimum or a local
maximum. The number of distinct extrema for the curve
4 3 2
3x 16x 24x 37 is − + +
(A) 0 (B) 1 (C) 2 (D) 3
26. If P, Q, R are Boolean variables, then
( ) ( ) ( )
P Q P.Q P.R P.R Q + + +
Simplifies to
(A) P.Q (B) P.R (C) P.Q R + (D) P.R Q +
27. Aishwarya studies either computer science or mathematics everyday. If she
studies computer science on a day, then the probability that the studies
mathematics the next day is 0.6. If she studies mathematics on a day, then the
probability that the studies computer science the next day is 0.4. Given that
Aishwarya studies computer science on Monday, what is the probability that she
studies computer science on Wednesday?
(A) 0.24 (B) 0.36 (C) 0.4 (D) 0.6
28. How many of the following matrices have an eigenvalue 1?
1 0 0 1 1 1 1 0
and
0 0 0 0 1 1 1 1
− −
−
(A) one (B) two (C) three (D) four
29. Let X be a random variable following normal distribution with mean +1 and
variance 4. Let Y be another normal variable with mean 1 and variance
unknown. If ( ) ( ) P X 1 P Y 2 , ≤ − = ≥ the standard deviation of Y is
(A) 3 (B) 2 (C) 2 (D) 1
30. Let fsa and pda be two predicates such that fsa(x) means x is a finite state
automaton, and pda(y) means that y is a pushdown automaton. Let equivalent
be another predicate such that equivalent (a, b) means a and b are equivalent.
Which of the following first order logic statements represents the following:
Each finite state automaton has an equivalent pushdown automaton
(A) ( ) ( ) ( ) ( ) ( )
x fsa x y pda y equivalent x, y ∀ ⇒ ∃ ∧
(B) ( ) ( ) ( ) ( )
~ y x fsa x pda y equivalent x, y ∀ ∃ ⇒ ∧
(C) ( ) ( ) ( ) ( )
x y fsa x pda y equivalent x, y ∀ ∃ ∧ ∧
(D) ( ) ( ) ( ) ( )
x y fsa y pda x equivalent x, y ∀ ∃ ∧ ∧
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 6 of 20
31. P and Q are two propositions. Which of the following logical expressions are
equivalent?
( )
( ) ( ) ( )
( ) ( ) ( )
I. P ~ Q
II. ~ ~P Q
III. P Q P ~ Q ~P ~ Q
IV. P Q P ~ Q ~P Q
∨
∧
∧ ∨ ∧ ∨ ∧
∧ ∨ ∧ ∨ ∧
(A) Only I and II (B) Only I, II and III
(C) Only I, II and IV (D) All of I, II III and IV
32. For a magnetic disk with concentric circular tracks, the seek latency is not linearly
proportional to the seek distance due to
(A) nonuniform distribution of requests
(B) arm starting and stopping inertia
(C) higher capacity of tracks on the periphery of the platter
(D) use of unfair arm scheduling policies
33. Which of the following is/are true of the autoincrement addressing mode?
I. It is useful in creating selfrelocating code
II. If it is included in an Instruction Set Architecture, then an additional ALU is
required for effective address calculation
III. The amount of increment depends on the size of the data item accessed
(A) I only (B) II only (C) III only (D) II and III only
34. Which of the following must be true for the RFE (Return From Exception)
instruction on a general purpose processor?
I. It must be a trap instruction
II. It must be a privileged instruction
III. An exception cannot be allowed to occur during execution of an RFE
instruction
(A) I only (B) II only
(C) I and II only (D) I, II and III only
35. For inclusion to hold between two cache levels L1 and L2 in a multilevel cache
hierarchy, which of the following are necessary?
I. L1 must be a writethrough cache
II. L2 must be a writethrough cache
III. The associativity of L2 must be greater than that of L1
IV. The L2 cache must be at least as large as the L1 cache
(A) IV only (B) I and IV only
(C) I, II and IV only (D) I, II, III and IV
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 7 of 20
36. Which of the following are NOT true in a pipelined processor?
I. Bypassing can handle all RAW hazards
II. Register renaming can eliminate all register carried WAR hazards
III. Control hazard penalties can be eliminated by dynamic branch prediction
(A) I and II only (B) I and III only (C) II and III only (D) I, II and III
37. The use of multiple register windows with overlap causes a reduction in the
number of memory accesses for
I. Function locals and parameters
II. Register saves and restores
III. Instruction fetches
(A) I only (B) II only (C) III only (D) I, II and III
38. In an instruction execution pipeline, the earliest that the data TLB (Translation
Lookaside Buffer) can be accessed is
(A) Before effective address calculation has started
(B) During effective address calculation
(C) After effective address calculation has completed
(D) After data cache lookup has completed
39. Consider the following functions:
( )
( )
( )
n
logn
f n 2
g n n!
h n n
=
=
=
Which of the following statements about the asymptotic behaviour of f(n), g(n),
and h(n) is true?
(A) ( ) ( ) ( ) ( ) ( ) ( )
f n O g n ; g n O h n = = (B) ( ) ( ) ( ) ( ) ( ) ( )
f n g n ; g n O h n = Ω =
(C) ( ) ( ) ( ) ( ) ( ) ( )
g n O f n ; h n O f n = = (D) ( ) ( ) ( ) ( ) ( ) ( )
h n O f n ; g n f n = = Ω
40. The minimum number of comparisons required to determine if an integer appears
more than n/2 times in a sorted array of n integers is
(A) ( ) n Θ (B) ( ) logn Θ (C) ( ) log*n Θ (D) ( ) 1 Θ
41. A Btree of order 4 is built from scratch by 10 successive insertions. What is the
maximum number of node splitting operations that may take place?
(A) 3 (B) 4 (C) 5 (D) 6
42. G is a graph on n vertices and 2n2 edges. The edges of G can be partitioned into
two edgedisjoint spanning trees. Which of the following is NOT true for G?
(A) For every subset of k vertices, the induced subgraph has at most 2k2 edges
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 8 of 20
(B) The minimum cut in G has at least two edges
(C) There are two edgedisjoint paths between every pair of vertices
(D) There are two vertexdisjoint paths between every pair of vertices
43. Consider the Quicksort algorithm. Suppose there is a procedure for finding a
pivot element which splits the list into two sublists each of which contains at
least onefifth of the elements. Let T(n) be the number of comparisons required
to sort n elements. Then
(A) ( ) ( ) T n 2T n /5 n ≤ + (B) ( ) ( ) ( ) T n T n /5 T 4n /5 n ≤ + +
(C) ( ) ( ) T n 2T 4n /5 n ≤ + (D) ( ) ( ) T n 2T n / 2 n ≤ +
44. The subsetsum problem is defined as follows: Given a set S of n positive
integers and a positive integer W, determine whether there is a subset of S
Whose elements sum to W.
An algorithm Q solves this problem in O(nW) time. Which of the following
statements is false?
(A) Q solves the subsetsum problem in polynomial time when the input is
encoded in unary
(B) Q solves the subsetsum problem in polynomial time when the input is
encoded in binary
(C) The subset sum problem belongs to the class NP
(D) The subset sum problem is NPhard
45.
Dijkstra’s single source shortest path algorithm when run from vertex a in the
above graph, computes the correct shortest path distance to
(A) only vertex a (B) only vertices a, e, f, g, h
(C) only vertices a, b, c, d (D) all the vertices
46. You are given the postorder traversal, P, of a binary search tree on the n
elements 1, 2,….,n. You have to determine the unique binary search tree that has
P as its postorder traversal. What is the time complexity of the most efficient
algorithm for doing this?
(A) ( ) logn Θ (B) ( ) n Θ (C) ( ) nlogn Θ
(D) None of the above, as the tree cannot be uniquely determined
b
a c
d
2
1 2
3
e
h f
g
2
1 2
3
1
5 −
3 −
2
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 9 of 20
47. We have a binary heap on n elements and wish to insert n more elements (not
necessarily one after another) into this heap. The total time required for this is
(A) ( ) logn Θ (B) ( ) n Θ (C) ( ) nlogn Θ (D)
( )
2
n Θ
48. Which of the following statements is false?
(A) Every NFA can be converted to an equivalent DFA
(B) Every nondeterministic Turing machine can be converted to an equivalent
deterministic Turing machine
(C) Every regular language is also a contextfree language
(D) Every subset of a recursively enumerable set is recursive
49. Given below are two finite state automata (→ indicates the start state and F
indicates a final state)
Y:
( )
a b
1 1 2
2 F 2 1
→ Z:
( )
a b
1 2 2
2 F 1 1
→
Which of the following represents the product automaton Z×Y?
(A)
( )
a b
P S R
Q R S
R F Q P
S Q P
→
(B)
( )
a b
P S Q
Q R S
R F Q P
S P Q
→
(C)
( )
a b
P Q S
Q R S
R F Q P
S Q P
→
(D)
( )
a b
P S Q
Q S R
R F Q P
S Q P
→
50. Which of the following statements are true?
I. Every leftrecursive grammar can be converted to a rightrecursive grammar
and viceversa
II. All εproductions can be removed from any contextfree grammar by suitable
transformations
III. The language generated by a contextfree grammar all of whose productions
are of the form X w or X wY → → (where, w is a string of terminals and Y is
a nonterminal), is always regular
IV. The derivation trees of strings generated by a contextfree grammar in
Chomsky Normal Form are always binary trees
(A) I, II, III and IV (B) II, III and IV only
(C) I, III and IV only (D) I, II and IV only
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 10 of 20
51. Match the following:
E. Checking that identifiers are
declared before their use
P.
{ }
n m n m
L a b c d n 1,m 1 = ≥ ≥
F. Number of formal parameters in
the declaration of a function
agrees with the number of actual
parameters in use of that function
Q. X XbX XcX dXf g →
G. Arithmetic expressions with
matched pairs of parentheses
R.
{ }
L wcw w (a b) * = ∈
H. Palindromes S. X bXb cXc → ε
(A) E P, F R, G Q, H S − − − − (B) E R, F P, G S, H Q − − − −
(C) E R, F P, G Q, H S − − − − (D) E P, F R, G S, H Q − − − −
52. Match the following NFAs with the regular expressions they correspond to
P.
Q.
R.
S.
1. ( ) 0 01*1 00 *01* ε + +
2. ( ) 0 10 *1 00 * 0 ε + +
3. ( ) 0 10 *1 10 *1 ε + +
4. ( ) 0 10 *1 10 *10 * ε + +
1
0
0
0
1
0
1
0
0
1
0
1
1
0
1
0
1
1 0
1
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 11 of 20
(A) P 2, Q 1, R 3, S 4 − − − − (B) P 1, Q 3, R 2, S 4 − − − −
(C) P 1, Q 2, R 3, S 4 − − − − (D) P 3, Q 2, R 1, S 4 − − − −
53. Which of the following are regular sets?
I.
{ }
n 2m
a b n 0,m 0 ≥ ≥
II.
{ }
n m
a b n 2m =
III.
{ }
n m
a b n m ≠
IV. { } { }
xcy x, y, a,b * ∈
(A) I and IV only (B) I and III only (C) I only (D) IV only
54. Which of the following are true?
I. A programming language which does not permit global variables of any kind
and has no nesting of procedures/functions, but permits recursion can be
implemented with static storage allocation
II. Multilevel access link (or display) arrangement is needed to arrange
activation records only if the programming language being implemented has
nesting of procedures/functions
III. Recursion in programming languages cannot be implemented with dynamic
storage allocation
IV. Nesting procedures/functions and recursion require a dynamic heap
allocation scheme and cannot be implemented with a stackbased allocation
scheme for activation records
V. Programming languages which permit a function to return a function as its
result cannot be implemented with a stackbased storage allocation scheme
for activation records
(A) II and V only (B) I, III and IV only
(C) I, II and V only (D) II, III and V only
55. An LALR(1) parser for a grammar G can have shiftreduce (SR) conflicts if and
only if
(A) The SLR(1) parser for G has SR conflicts
(B) The LR(1) parser for G has SR conflicts
(C) The LR(0) parser for G has SR conflicts
(D) The LALR(1) parser for G has reducereduce conflicts
56. In the slow start phase of the TCP congestion control algorithm, the size of the
congestion window
(A) does not increase (B) increases linearly
(C) increases quadratically (D) increases exponentially
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 12 of 20
57. If a class B network on the Internet has a subnet mask of 255.255.248.0, what is
the maximum number of hosts per subnet?
(A) 1022 (B) 1023 (C) 2046 (D) 2047
58. A computer on a 10Mbps network is regulated by a token bucket. The token
bucket is filled at a rate of 2Mbps. It is initially filled to capacity with 16Megabits.
What is the maximum duration for which the computer can transmit at the full
10Mbps?
(A) 1.6 seconds (B) 2 seconds (C) 5 seconds (D) 8 seconds
59. A client process P needs to make a TCP connection to a server process S.
Consider the following situation: the server process S executes a socket (), a
bind () and a listen () system call in that order, following which it is preempted.
Subsequently, the client process P executes a socket () system call followed by
connect () system call to connect to the server process S. The server process has
not executed any accept () system call. Which one of the following events could
take place?
(A) connect () system call returns successfully
(B) connect () system call blocks
(C) connect () system call returns an error
(D) connect () system call results in a core dump
60. What is printed by the following C program?
( ) ( )
( ) ( )
int f int x, int *py, int **ppz void main
{ {
int y, z; int c, *b, **a;
**ppz 1; z *ppz; c 4; b &c; a &b;
*py 2; y *py; pr int f "%d", f c,b, a ;
x 3; }
return x y z;
}
+ = = = = =
+ = =
+ =
+ +
(A) 18 (B) 19 (C) 21 (D) 22
61. Choose the correct option to fill ? 1 and ? 2 so that the program below prints an
input string in reverse order. Assume that the input string is terminated by a
newline character.
( )
( ) ( )
( )
( ) ( )
( ) ( )
void recerse void {
int c;
if ?1 reverse ;
?2
}
main {
pr int f "Enter Text " ; pr int f "\ n" ;
reverse ;pr int f "\ n" ;
}
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 13 of 20
(A) ( ) ( )
?1 is getchar ! '\ n' =
( ) ?2 is getchar c ;
(B) ( ) ) ( )
?1 is c getchar ! '\ n' = =
( ) ?2 is getchar c ;
(C) ( ) ?1 is c ! '\ n' =
( ) ?2 is putchar c ;
(D) ( ( ) ) ( )
?1 is c getchar ! '\ n' = =
( ) ?2 is putchar c ;
62. The following C function takes a singlelinked list of integers as a parameter and
rearranges the elements of the list. The function is called with the list containing
the integers 1,2,3,4,5,6,7 in the given order. What will be the contents of the list
after the function completes execution?
( )
( )
( )
struct node {
int value;
struct node *next;
};
Void rearrange struct node *list {
struct node *p, * q;
int temp;
if !list !list next return;
p list; q list next;
while q {
temp p value;p value q value;
q value temp;p q next;
q
− >
= = − >
= − > − > = − >
− > = = − >
p?p next : 0;
}
}
= − >
(A) 1,2,3, 4,5, 6,7 (B) 2,1, 4,3, 6,5,7 (C) 1,3,2,5, 4,7, 6 (D) 2,3, 4,5, 6,7,1
63. The P and V operations on counting semaphores, where s is a counting
semaphore, are defined as follows:
( )
( )
P s : s s 1;
ifs 0 then wait;
V s : s s 1;
ifs 0 then wakeup a process waiting on s;
= −
<
= +
<=
Assume that P
b
and V
b
the wait and signal operations on binary semaphores are
provided. Two binary semaphores x
b
and y
b
are used to implement the
semaphore operations P(s) and V(s) as follows:
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 14 of 20
( ) ( )
( )
( )
( )
( )
( ) ( )
( ) ( )
( )
b b
b b
b b
b b
b b
b b
b b
P s : P x ;
s s 1;
if s 0 {
V x ;
P y ;
}
else V x ;
V s : P x ;
s s 1;
if s 0 V y ;
V x ;
= −
<
= +
<=
The initial values of x
b
and y
b
are respectively
(A) 0 and 0 (B) 0 and 1 (C) 1 and 0 (D) 1 and 1
64. Which of the following statements about synchronous and asynchronous I/O is
NOT true?
(A) An ISR is invoked on completion of I/O in synchronous I/O but not in
asynchronous I/O
(B) In both synchronous and asynchronous I/O, an ISR (Interrupt Service
Routine) is invoked after completion of the I/O
(C) A process making a synchronous I/O call waits until I/O is complete, but a
process making an asynchronous I/O call does not wait for completion of the
I/O
(D) In the case of synchronous I/O, the process waiting for the completion of I/O
is woken up by the ISR that is invoked after the completion of I/O
65. Which of the following is NOT true of deadlock prevention and deadlock
avoidance schemes?
(A) In deadlock prevention, the request for resources is always granted if the
resulting state is safe
(B) In deadlock avoidance, the request for resources is always granted if the
result state is safe
(C) Deadlock avoidance is less restrictive than deadlock prevention
(D) Deadlock avoidance requires knowledge of resource requirements a priori
66. A process executes the following code
( ) ( ) for i 0; i n; i for ; = < + +
The total number of child processes created is
(A) n (B)
n
2 1 − (C)
n
2 (D)
n 1
2 1
+
−
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 15 of 20
67. A processor uses 36 bit physical addresses and 32 bit virtual addresses, with a
page frame size of 4 Kbytes. Each page table entry is of size 4 bytes. A three
level page table is used for virtual to physical address translation, where the
virtual address is used as follows
• Bits 3031 are used to index into the first level page table
• Bits 2129 are used to index into the second level page table
• Bits 1220 are used to index into the third level page table, and
• Bits 011 are used as offset within the page
The number of bits required for addressing the next level page table (or page
frame) in the page table entry of the first, second and third level page tables are
respectively
(A) 20, 20 and 20 (B) 24, 24 and 24 (C) 24, 24 and 20 (D) 25, 25 and 24
68. Let R and S be two relations with the following schema
( )
( )
R P, Q,R1,R2,R3
S P, Q, S1, S2
Where {P, Q} is the key for both schemas. Which of the following queries are
equivalent?
( )
( ) ( )
( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
P
P P
P P,Q P,Q
P P,Q P,Q P,Q
I. R S
II. R S
III. R S
IV. R R S
Π
Π Π
Π Π ∩ Π
Π Π − Π − Π
(A) Only I and II (B) Only I and III
(C) Only I, II and III (D) Only I, III and IV
69. Consider the following relational schemes for a library database:
( )
( )
Book Title, Author, Catalog_no, Publisher, Year, Pr ice
Collection Title, Author, Catalog_no
with in the following functional dependencies:
I. Title Author Catalog_no
II. Catalog_no Title Author Publisher Year
III. Publisher Title Year Pr ice
→
→
→
Assume {Author, Title} is the key for both schemes. Which of the following
statements is true?
(A) Both Book and Collection are in BCNF
(B) Both Book and Collection are in 3NF only
(C) Book is in 2NF and Collection is in 3NF
(D) Both Book and Collection are in 2NF only
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 16 of 20
70. Consider a file of 16384 records. Each record is 32 bytes long and its key field is
of size 6 bytes. The file is ordered on a nonkey field, and the file organization is
unspanned. The file is stored in a file system with block size 1024 bytes, and the
size of a block pointer is 10 bytes. If the secondary index is built on the key field
of the file, and a multilevel index scheme is used to store the secondary index,
the number of firstlevel and secondlevel blocks in the multilevel index are
respectively
(A) 8 and 0 (B) 128 and 6 (C) 256 and 4 (D) 512 and 5
Common Data for Questions: 71 72 and 73
Consider a machine with a 2way set associative data cache of size 64Kbytes and
block size 16bytes. The cache is managed using 32 bit virtual addresses and the
page size is 4Kbyts. A program to be run on this machine begins as follows:
( )
( )
double ARR 1024 1024 ;
int i, j ;
/* Initialize array ARR to 0.0 * /
for i 0;i 1024; i
for j 0; j 1024; j
ARR i j 0.0;
= < + +
= < + +
=
The size of double is 8Bytes. Array ARR is located in memory starting at the
beginning of virtual page 0xFF000 and stored in row major order. The cache is
initially empty and no prefetching is done. The only data memory references
made by the program are those to array ARR
71. The total size of the tags in the cache directory is
(A) 32Kbits (B) 34Kbits (C) 64Kbits (D) 68Kbits
72. Which of the following array elements has the same cache index as ARR [0] [0]?
(A) ARR [0] [4] (B) ARR [4] [0] (C) ARR [0] [5] (D) ARR [5] [0]
73. The cache hit ratio for this initialization loop is
(A) 0% (B) 25% (C) 50% (D) 75%
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 17 of 20
Common Data for Questions: 74 and 75
Consider the following C functions:
( )
( )
( ) ( ) ( )
( )
( )
int f1 int n
{
if n 0 n 1
return n;
else
return 2 * f1 n 1 3* f1 n 2 ;
}
int f2 int n
{
int i;
int X N , Y N , Z N ;
X 0 Y 0 Z 0 0;
X 1 1; Y 1 2; Z 1 3;
for i 2; i n; i {
X i Y i 1 Z i 2 ;
Y i 2 * X i
= = = =
− + −
= = =
= = =
= <= + +
= − + −
=
;
Z i 3 * X i ;
}
return X n ;
}
=
74. The running time of f1 (n) and f2 (n) are
(A) ( ) ( ) n and n Θ Θ (B)
( ) ( )
n
2 and n Θ Θ
(C) ( ) ( )
n
n and 2 Θ Θ (D)
( ) ( )
n n
2 and 2 Θ Θ
75. F1 (8) and f2 (8) return the values
(A) 1661 and 1640 (B) 59 and 59
(C) 1640 and 1640 (D) 1640 and 1661
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 18 of 20
Linked Answer Questions: Q.76 to 85 Carry Two Marks Each
Statement for Linked Answer Questions: 76 & 77
Delayed branching can help in the handling of control hazards
76. For all delayed conditional branch instructions, irrespective of whether the
condition evaluates to true or false
(A) The instruction following the conditional branch instruction in memory is
executed
(B) The first instruction in the fall through path is executed
(C) The first instruction in the taken path is executed
(D) The branch takes longer to execute than any other instruction
77. The following code is to run on a pipelined processor with one branch delay slot:
I1: ADD R2 R7 R8
I2: SUB R4 R5 R6
I3: ADD R1 R2 R3
I4: STORE Memory R4 R1
BRANCH to Label if R1 0
← +
← −
← +
←
= =
Which of the instructions I1, I2, I3 or I4 can legitimately occupy the delay slot
without any other program modification?
(A) I1 (B) I2 (C) I3 (D) I4
Statement for Linked Answer Questions: 78 & 79
Let x
n
denote the number of binary strings of length n that contain no
consecutive 0s.
78. Which of the following recurrences does x
n
satisfy?
(A)
n n 1
x 2x
−
= (B)
n n/ 2
x x 1 = + (C)
n n/ 2
x x n = + (D)
n n 1 n 2
x x x
− −
= +
79. The value of x
5
is
(A) 5 (B) 7 (C) 8 (D) 16
Statement for Linked Answer Questions: 80 & 81
The subsetsum problem is defined as follows. Given a set of n positive integers,
{ }
1 2 3 n
S a , a , a ,..., a , = and positive integer W, is there a subset of S whose
elements sum to W? A dynamic program for solving this problem uses a
2dimensional Boolean array, X, with n rows and W+1 columns.
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 19 of 20
X i, j ,1 i n, 0 j W, ≤ ≤ ≤ ≤
is TRUE if and only if there is a subset of { }
1 2 i
a , a ,..., a
whose elements sum to j.
80. Which of the following is valid for
i
2 i n and a j W? ≤ ≤ ≤ ≤
(A)
i
X i, j X i 1, j X i, j a = − ∨ −
(B)
i
X i, j X i 1, j X i 1, j a = − ∨ − −
(C)
i
X i, j X i 1, j X i, j a = − ∧ −
(D)
i
X i, j X i 1, j X i 1, j a = − ∧ − −
81. Which entry of the array X, if TRUE, implies that there is a subset whose
elements sum to W?
(A) X 1, W
(B) X n, 0
(C) X n, W
(D) X n 1,n −
Statement for Linked Answer Questions: 82 & 83
Consider the following ER diagram
82. The minimum number of tables needed to represent M, N, P, R1, R2 is
(A) 2 (B) 3 (C) 4 (D) 5
83. Which of the following is a correct attribute set for one of the tables for the
correct answer to the above question?
(A) { } M1,M2,M3,P1 (B) { } M1,P1,N1,N2 (C) { } M1,P1,N1 (D) { } M1,P1
Statement for Linked Answer Questions: 84 & 85
Consider the following C program that attempts to locate an element x in an
array Y[ ] using binary search. The program is erroneous.
( )
( )
( )
( ) ( ) ( )
( ) ( )
( )
1. f int Y 10 , int x {
2. int u, j, k;
3. i 0; j 9;
4. do {
5. k i j / 2;
6. if Y k x i k;else j k;
7. } while Y k ! x & & i j ;
8. if Y k x pr int f " x is in the array" ;
9. else pr int f " x is not in the array" ;
10. }
= =
= +
< = =
= <
= =
M1 M2 M3
M P
N2 N1 P2 P1
R1 R2 N
CS GATE Paper 2008 www.gateforum.com
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com. Page 20 of 20
84. On which of the following contents of Y and x does the program fail?
(A) Y is 1 2 3 4 5 6 7 8 9 10 and x 10 <
(B) Y is 1 3 5 7 9 11 13 15 17 19 and x 1 <
(C) Y is 2 2 2 2 2 2 2 2 2 2 and x 2 >
(D) Y is 2 4 6 8 10 12 14 16 18 20 and 2 x 20 and x is even < <
85. The correction needed in the program to make it work properly is
(A)
( )
Change line 6 to:if Y k x i k 1; else j k 1; < = + = −
(B)
( )
Change line 6 to:if Y k x i k 1; else j k 1; < = − = +
(C)
( )
Change line 6 to:if Y k x i k; else j k; < = = =
(D)
( ) ( ) ( )
Change line 7 to:} while Y k x & & i j ; = = <
CS GATE Paper 2008
7.
www.gateforum.com
The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity (A) Θ (n)
(B) Θ (m)
(C) Θ (m + n)
(D) Θ (mn)
8.
Given f1, f3 and f in canonical sum of products form (in decimal) for the circuit
f1 f2
f
f1 = Σm ( 4,5, 6, 7, 8 ) f3 = Σm (1, 6,15) f = Σm (1, 6, 8,15) then f2 is (A) Σ m ( 4, 6 )
f3
(B) Σ m ( 4, 8 )
(C) Σ m ( 6, 8 )
(D) Σ m ( 4, 6, 8 )
9.
Which of the following is true for the language ap p is a prime ? (A) It is not accepted by a Turing Machine (B) It is regular but not contextfree (C) It is contextfree but not regular (D) It is neither regular nor contextfree, but accepted by a Turing machine
{
}
10.
Which of the following are decidable? I. Whether the intersection of two regular languages is infinite II. Whether a given contextfree language is regular III. Whether two pushdown automata accept the same language IV. Whether a given grammar is contextfree (A) I and II (B) I and IV (C) II and III (D)II and IV
11.
Which of the following describes a handle (as applicable to LRparsing) appropriately? (A) It is the position in a sentential form where the next shift or reduce operation will occur (B) It is nonterminal whose production will be used for reduction in the next step (C) It is a production that may be used for reduction in a future step along with a position in the sentential form where the next shift or reduce operation will occur (D) It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be found
© All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the written permission. Discuss this questions paper at www.gateforum.com. Page 2 of 20
y = 3. IV.CS GATE Paper 2008 12. z = 5 (B) x = 6. 18. Which of the following system calls results in the sending of SYN packets? (A) socket (B) bind (C) listen (D) connect Which combination of the integer variables x. If L and L are recursively enumerable then L is (A) regular (C) contextsensitive (B) contextfree (D) recursive 14. z = 5 © All rights reserved by GATE Forum Educational Services Pvt. Which of the following tuple relational calculus expression(s) is/are equivalent to ∀t ∈ r (P ( t ) ) ? I. Page 3 of 20 .com Some code optimizations are carried out on the intermediate code because (A) They enhance the portability of the compiler to other target processors (B) Program analysis is more accurate on intermediate code than on machine code (C) The information from dataflow analysis cannot otherwise be used for optimization (D) The information from the front end cannot otherwise be used for optimization 13.com. y = 5. y and z makes the variable a get the value 4 in the following expression? a = (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z) (A) x = 3. www.gateforum.gateforum. z = 2 (C) x = 6. II. y = 4. Ltd. ¬∃t ∈ r (P ( t ) ) ∃t ∉ r (P ( t ) ) ¬∃t ∈ r ( ¬P ( t ) ) ∃t ∉ r ( ¬P ( t ) ) (B) II only (D) III and IV only (A) I only (C) III only 16. y = 4. III. No part of this booklet may be reproduced or utilized in any form without the written permission. A clustering index is defined on the fields which are of type (A) nonkey and ordering (C) key and ordering (B) nonkey and nonordering (D) key and nonordering 17. z = 3 (D) x = 5. Discuss this questions paper at www. What is the maximum size of data that the application layer can pass on to the TCP layer below? (A) Any size (C) 216 bytes (B) 216 bytessize of TCP header (D) 1500 bytes 15.
Discuss this questions paper at www. Which of the following statements is true for every planar graph on n vertices? (A) The graph is connected (B) The graph is Eulerian (C) The graph has a vertexcover of size at most 3n/4 (D) The graph has an independent set of size at least n/3 24. Then (C) P = Q (D) P = Q + 2K (A) P = Q − K (B) P = Q + K © All rights reserved by GATE Forum Educational Services Pvt. where k is a positive integer. Let P = 1≤i≤2k i odd ∑ i and Q = 1≤i≤2k i even ∑ i.CS GATE Paper 2008 19.gateforum. The minimum number of equal length subintervals needed to approximate 2 1 x −6 ∫ xe dx to an accuracy of at least 3 × 10 u sin g the trapezoidal rule is 1 (A) 1000e (B) 1000 (C) 100e (D) 100 22.gateforum.21 – Q. Page 4 of 20 .com. www. No part of this booklet may be reproduced or utilized in any form without the written permission. Ltd. One possible order of visiting the nodes of the following graph is M N O R Q P (A) MNOPQR 20. The NewtonRaphson iteration xn+1 = (A) square of R (C) square root of R 1 R xn + can be used to compute the 2 xn (B) reciprocal of R (D) logarithm of R 23. (B) NQMPOR (C) QMNPRO (D) QMNPOR The data blocks of a very large file in the Unix file system are allocated using (A) contiguous allocation (B) linked allocation (C) indexed allocation (D) an extension of indexed allocation Q.75 Carry Two Marks Each 21.com The Breadth First Search algorithm has been implemented using the queue data structure.
R + Q 27.gateforum. then (P + Q)(P. If she studies computer science on a day. Aishwarya studies either computer science or mathematics everyday. If P.4 (D) 0. Q.gateforum. Let Y be another normal variable with mean 1 and variance unknown. y ) ) © All rights reserved by GATE Forum Educational Services Pvt. b) means a and b are equivalent. the standard deviation of Y is (A) 3 (B) 2 (C) 2 (D) 1 30.com A point on a curve is said to be an extremum if it is a local minimum or a local maximum. Page 5 of 20 .R )(P. Let fsa and pda be two predicates such that fsa(x) means x is a finite state automaton. then the probability that the studies mathematics the next day is 0.R + Q) Simplifies to (A) P.4. y ) ) (D) ∀x ∃y ( fsa ( y ) ∧ pda ( x ) ∧ equivalent ( x.Q + R (D) P. Let equivalent be another predicate such that equivalent (a.36 (C) 0. Ltd.com. R are Boolean variables. No part of this booklet may be reproduced or utilized in any form without the written permission. then the probability that the studies computer science the next day is 0. Which of the following first order logic statements represents the following: Each finite state automaton has an equivalent pushdown automaton (A) ( ∀x fsa ( x )) ⇒ ( ∃y pda ( y ) ∧ equivalent ( x.R (C) P. www. How many of the following matrices have an eigenvalue 1? 1 0 0 1 1 0 0 0 0 1 (A) one − 1 −1 0 and 1 1 − 1 (B) two (C) three (D) four 29.Q (B) P.Q + P. and pda(y) means that y is a pushdown automaton.6. If P ( X ≤ −1) = P ( Y ≥ 2 ) . Given that Aishwarya studies computer science on Monday. The number of distinct extrema for the curve 3x 4 − 16x3 + 24x2 + 37 is (A) 0 (B) 1 (C) 2 (D) 3 26. Discuss this questions paper at www. what is the probability that she studies computer science on Wednesday? (A) 0.CS GATE Paper 2008 25. y ) ) (B) ~ ∀y ( ∃x fsa ( x ) ⇒ pda ( y ) ∧ equivalent ( x.6 28. y ) ) (C) ∀x ∃y ( fsa ( x ) ∧ pda ( y ) ∧ equivalent ( x. If she studies mathematics on a day.24 (B) 0. Let X be a random variable following normal distribution with mean +1 and variance 4.
II.gateforum. Which of the following must be true for the RFE (Return From Exception) instruction on a general purpose processor? I.com P and Q are two propositions. II III and IV (A) Only I and II (C) Only I. the seek latency is not linearly proportional to the seek distance due to (A) nonuniform distribution of requests (B) arm starting and stopping inertia (C) higher capacity of tracks on the periphery of the platter (D) use of unfair arm scheduling policies 33. Page 6 of 20 .com.CS GATE Paper 2008 31. No part of this booklet may be reproduced or utilized in any form without the written permission. III and IV © All rights reserved by GATE Forum Educational Services Pvt. Discuss this questions paper at www. An exception cannot be allowed to occur during execution of an RFE instruction (A) I only (C) I and II only (B) II only (D) I. which of the following are necessary? I. III. If it is included in an Instruction Set Architecture. Ltd. It must be a trap instruction II. It is useful in creating selfrelocating code II. For inclusion to hold between two cache levels L1 and L2 in a multilevel cache hierarchy. II and III (D) All of I. II and III only 35. For a magnetic disk with concentric circular tracks. II and IV only (B) I and IV only (D) I. The associativity of L2 must be greater than that of L1 IV. P∨ ~ Q ~ (~ P ∧ Q ) (P ∧ Q ) ∨ (P ∧ ~ Q ) ∨ (~ P ∧ ~ Q ) (P ∧ Q ) ∨ (P ∧ ~ Q ) ∨ (~ P ∧ Q ) (B) Only I. II. www.gateforum. The amount of increment depends on the size of the data item accessed (A) I only (B) II only (C) III only (D) II and III only 34. The L2 cache must be at least as large as the L1 cache (A) IV only (C) I. IV. then an additional ALU is required for effective address calculation III. II and IV 32. L1 must be a writethrough cache II. Which of the following logical expressions are equivalent? I. It must be a privileged instruction III. L2 must be a writethrough cache III. Which of the following is/are true of the autoincrement addressing mode? I.
and h(n) is true? (A) f (n) = O ( g (n) ) . Bypassing can handle all RAW hazards www. Instruction fetches (A) I only (B) II only (C) III only (D) I. Register saves and restores III. Consider the following functions: f (n) = 2n g (n) = n! h (n) = nlogn Which of the following statements about the asymptotic behaviour of f(n). Control hazard penalties can be eliminated by dynamic branch prediction (A) I and II only 37. g (n) = O (h (n) ) (D) h (n) = O ( f (n) ) .CS GATE Paper 2008 36. What is the maximum number of node splitting operations that may take place? (A) 3 (B) 4 (C) 5 (D) 6 42. Page 7 of 20 . The edges of G can be partitioned into two edgedisjoint spanning trees. Function locals and parameters II.com. g (n) = Ω ( f (n) ) 40. In an instruction execution pipeline.gateforum. the induced subgraph has at most 2k2 edges © All rights reserved by GATE Forum Educational Services Pvt. G is a graph on n vertices and 2n2 edges. Which of the following are NOT true in a pipelined processor? I. II and III 38. Register renaming can eliminate all register carried WAR hazards III. The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is (A) Θ (n) (B) Θ (logn) (C) Θ (log* n) (D) Θ (1) 41. h (n) = O ( f (n) ) (B) f (n) = Ω ( g (n) ) . No part of this booklet may be reproduced or utilized in any form without the written permission. II and III The use of multiple register windows with overlap causes a reduction in the number of memory accesses for I. the earliest that the data TLB (Translation Lookaside Buffer) can be accessed is (A) Before effective address calculation has started (B) During effective address calculation (C) After effective address calculation has completed (D) After data cache lookup has completed 39. Discuss this questions paper at www.gateforum. A Btree of order 4 is built from scratch by 10 successive insertions. Which of the following is NOT true for G? (A) For every subset of k vertices. g(n). Ltd. g (n) = O (h (n) ) (C) g (n) = O ( f (n) ) . (B) I and III only (C) II and III only (D) I.com II.
as the tree cannot be uniquely determined © All rights reserved by GATE Forum Educational Services Pvt. (B) only vertices a.gateforum. No part of this booklet may be reproduced or utilized in any form without the written permission. The subsetsum problem is defined as follows: Given a set S of n positive integers and a positive integer W. Page 8 of 20 . Let T(n) be the number of comparisons required to sort n elements.CS GATE Paper 2008 (B) The minimum cut in G has at least two edges www. You have to determine the unique binary search tree that has P as its postorder traversal. computes the correct shortest path distance to (A) only vertex a (C) only vertices a. Suppose there is a procedure for finding a pivot element which splits the list into two sublists each of which contains at least onefifth of the elements. g. Consider the Quicksort algorithm. of a binary search tree on the n elements 1.….n. Ltd. Then (A) T (n) ≤ 2T (n / 5) + n (C) T (n) ≤ 2T ( 4n / 5) + n (B) T (n) ≤ T (n / 5) + T ( 4n / 5) + n (D) T (n) ≤ 2T (n / 2 ) + n 44. 2.com (C) There are two edgedisjoint paths between every pair of vertices (D) There are two vertexdisjoint paths between every pair of vertices 43. What is the time complexity of the most efficient algorithm for doing this? (A) Θ (logn) (B) Θ (n) (C) Θ (nlogn) (D) None of the above. 1 a 2 b 2 c −3 e 1 1 2 −5 h 2 f 3 g 3 d 2 Dijkstra’s single source shortest path algorithm when run from vertex a in the above graph. determine whether there is a subset of S Whose elements sum to W. d 46. P.. Which of the following statements is false? (A) Q solves the subsetsum problem in polynomial time when the input is encoded in unary (B) Q solves the subsetsum problem in polynomial time when the input is encoded in binary (C) The subset sum problem belongs to the class NP (D) The subset sum problem is NPhard 45. f. h (D) all the vertices You are given the postorder traversal. c.com. b. An algorithm Q solves this problem in O(nW) time. Discuss this questions paper at www. e.gateforum.
II and IV only © All rights reserved by GATE Forum Educational Services Pvt. III and IV only (B) II.com. The derivation trees of strings generated by a contextfree grammar in Chomsky Normal Form are always binary trees (A) I. Discuss this questions paper at www.com We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. Which of the following statements is false? (A) Every NFA can be converted to an equivalent DFA (B) Every nondeterministic Turing machine can be converted to an equivalent deterministic Turing machine (C) Every regular language is also a contextfree language (D) Every subset of a recursively enumerable set is recursive 49. All εproductions can be removed from any contextfree grammar by suitable transformations III. The total time required for this is (A) Θ (logn) (B) Θ (n) (C) Θ (nlogn) (D) Θ n2 ( ) 48. Given below are two finite state automata (→ indicates the start state and F indicates a final state) a b a b Z: 2 (F ) 1 1 →1 2 2 Y: 2 (F ) 2 1 →1 1 2 Which of the following represents the product automaton Z×Y? a b →P (A) a →P (B) Q S R P b →P (C) Q S S a b Q S R S Q P (D) →P Q S a b S R R S Q P S Q S Q S R R (F ) Q P S Q R (F ) Q P R (F ) Q P R (F ) Q P Q Q P 50. Page 9 of 20 . www. No part of this booklet may be reproduced or utilized in any form without the written permission. III and IV (C) I. The language generated by a contextfree grammar all of whose productions are of the form X → w or X → wY (where.gateforum. III and IV only (D) I.gateforum. Which of the following statements are true? I. Ltd. w is a string of terminals and Y is a nonterminal).CS GATE Paper 2008 47. is always regular IV. Every leftrecursive grammar can be converted to a rightrecursive grammar and viceversa II. II.
G − S. Match the following: E. F − P. 3. No part of this booklet may be reproduced or utilized in any form without the written permission. Ltd. H − Q (D) E − P. Checking that identifiers declared before their use are P. Q.com L = anbmcndm n ≥ 1. G − S. G − Q. 1 S. 4.CS GATE Paper 2008 51. H − Q (A) E − P. ε + 0 ( 01 * 1 + 00 ) * 01 * ε + 0 (10 * 1 + 00 ) * 0 ε + 0 (10 * 1 + 10 ) * 1 ε + 0 (10 * 1 + 10 ) * 10 * © All rights reserved by GATE Forum Educational Services Pvt. F − R.m ≥ 1 X → XbX XcX dXf g { } Number of formal parameters in the declaration of a function agrees with the number of actual parameters in use of that function Arithmetic expressions with matched pairs of parentheses Palindromes G. P. 0 1 1 0 1 1 0 0 1 1. www. F − R.gateforum. F. G − Q. Discuss this questions paper at www. L = {wcw w ∈ (a b) *} X → bXb cXc ε (B) E − R. Page 10 of 20 . H − S (C) E − R. 2. Match the following NFAs with the regular expressions they correspond to 1 1 0 0 0 0 0 Q. S. H. H − S 52. 1 1 0 R. F − P. R.com.gateforum.
Q − 1. Which of the following are true? I. R − 1. Page 11 of 20 . Q − 2. y. {a b {a b {a b n n n 2m n ≥ 0. S − 4 (C) P − 1. m ≥ 0 n = 2m n≠m } m } m } (B) I and III only (C) I only (D) IV only {xcy x. R − 2. S − 4 www. IV.com (B) P − 1. Q − 3. ∈ {a. II and V only 55. III and V only (A) II and V only (C) I. Multilevel access link (or display) arrangement is needed to arrange activation records only if the programming language being implemented has nesting of procedures/functions III.gateforum. R − 3. III and IV only (D) II. III. Which of the following are regular sets? I. Ltd. but permits recursion can be implemented with static storage allocation II. the size of the congestion window (A) does not increase (C) increases quadratically (B) increases linearly (D) increases exponentially © All rights reserved by GATE Forum Educational Services Pvt.com. Programming languages which permit a function to return a function as its result cannot be implemented with a stackbased storage allocation scheme for activation records (B) I.gateforum. A programming language which does not permit global variables of any kind and has no nesting of procedures/functions. Discuss this questions paper at www. Recursion in programming languages cannot be implemented with dynamic storage allocation IV. In the slow start phase of the TCP congestion control algorithm. Nesting procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stackbased allocation scheme for activation records V. S − 4 (D) P − 3. II.b} *} (A) I and IV only 54.CS GATE Paper 2008 (A) P − 2. No part of this booklet may be reproduced or utilized in any form without the written permission. R − 3. S − 4 53. Q − 2. An LALR(1) parser for a grammar G can have shiftreduce (SR) conflicts if and only if (A) The SLR(1) parser for G has SR conflicts (B) The LR(1) parser for G has SR conflicts (C) The LR(0) parser for G has SR conflicts (D) The LALR(1) parser for G has reducereduce conflicts 56.
int * py.gateforum.com If a class B network on the Internet has a subnet mask of 255. pr int f ("\ n") . * b.255. the client process P executes a socket () system call followed by connect () system call to connect to the server process S. a) ) . } (A) 18 (B) 19 void main ( ) { int c.gateforum.pr int f ("\ n") . What is printed by the following C program? int f (int x.CS GATE Paper 2008 57.com. Which one of the following events could take place? (A) connect () system call returns successfully (B) connect () system call blocks (C) connect () system call returns an error (D) connect () system call results in a core dump 60. The server process has not executed any accept () system call. ?2 } main ( ) { reverse ( } pr int f ("Enter Text ") . Discuss this questions paper at www. Ltd. Subsequently. ) .248. The token bucket is filled at a rate of 2Mbps. * *a. A computer on a 10Mbps network is regulated by a token bucket.b. It is initially filled to capacity with 16Megabits. * *ppz + = 1. } (C) 21 (D) 22 61. return x + y + z.0. c = 4.6 seconds (B) 2 seconds (C) 5 seconds (D) 8 seconds 59. x + = 3. z. © All rights reserved by GATE Forum Educational Services Pvt. Consider the following situation: the server process S executes a socket (). www. y = *py. what is the maximum number of hosts per subnet? (A) 1022 (B) 1023 (C) 2046 (D) 2047 58. a bind () and a listen () system call in that order. What is the maximum duration for which the computer can transmit at the full 10Mbps? (A) 1. No part of this booklet may be reproduced or utilized in any form without the written permission. * py + = 2. following which it is preempted. Page 12 of 20 . a = &b. b = &c. Choose the correct option to fill ? 1 and ? 2 so that the program below prints an input string in reverse order. Assume that the input string is terminated by a newline character. int * *ppz ) { int y. z = *ppz. A client process P needs to make a TCP connection to a server process S. void recerse ( void) { int c. if (?1) reverse ( ) . f ( c. pr int f (" %d".
4. 6.p− > value = q− > value.CS GATE Paper 2008 (A) ?1 is ( getchar ( www. are defined as follows: P ( s ) : s = s − 1.1.1 The P and V operations on counting semaphores. 7.3. Void rearrange ( struct node * list ) { struct node * p. if (!list !list − > next ) return.6. where s is a counting semaphore.3. 4.7 in the given order.2. V ( s ) : s = s + 1. ifs < 0 then wait.gateforum. q = list − > next.3. }. The function is called with the list containing the integers 1.5.com. * q. Discuss this questions paper at www.p = q− > next.gateforum.2. (C) ?1 is ( c ! = '\ n') ? 2 is putchar ( c ) . No part of this booklet may be reproduced or utilized in any form without the written permission. q− > value = temp. 4. Page 13 of 20 .5.com ) ! = '\ n') ? 2 is getchar ( c ) . (B) ?1 is ( c = getchar ( ? 2 is getchar ( c ) . q = p ? p− > next : 0. 4. (B) 2. Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. What will be the contents of the list after the function completes execution? struct node { int value.3. 4. 62. 7.5. int temp. Two binary semaphores xb and yb are used to implement the semaphore operations P(s) and V(s) as follows: © All rights reserved by GATE Forum Educational Services Pvt. 2.5. struct node * next. 6. Ltd. 6 (D) 2. 3. 6.5. ifs <= 0 then wakeup a process waiting on s. while ( q) { temp = p− > value. p = list. } } (A) 1. 7 63. (D) ?1 is ) ) ! = '\ n') ((c = getchar ( ) ) ! = '\ n') ? 2 is putchar ( c ) . The following C function takes a singlelinked list of integers as a parameter and rearranges the elements of the list. 7 (C) 1.
gateforum. s = s + 1. { } else Vb ( xb ) .gateforum. s = s − 1. i < n. the request for resources is always granted if the resulting state is safe (B) In deadlock avoidance. Discuss this questions paper at www. an ISR (Interrupt Service Routine) is invoked after completion of the I/O (C) A process making a synchronous I/O call waits until I/O is complete.CS GATE Paper 2008 P ( s ) : Pb ( xb ) . i + + ) for ( ). Vb ( yb ) . if ( s <= 0) Vb ( xb ) . but a process making an asynchronous I/O call does not wait for completion of the I/O (D) In the case of synchronous I/O. the request for resources is always granted if the result state is safe (C) Deadlock avoidance is less restrictive than deadlock prevention (D) Deadlock avoidance requires knowledge of resource requirements a priori 66. The initial values of xb and yb are respectively (A) 0 and 0 64. Page 14 of 20 . Pb ( yb ) . the process waiting for the completion of I/O is woken up by the ISR that is invoked after the completion of I/O 65. V ( s ) : Pb ( xb ) . No part of this booklet may be reproduced or utilized in any form without the written permission. if www. Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes? (A) In deadlock prevention. (B) 0 and 1 (C) 1 and 0 (D) 1 and 1 Which of the following statements about synchronous and asynchronous I/O is NOT true? (A) An ISR is invoked on completion of I/O in synchronous I/O but not in asynchronous I/O (B) In both synchronous and asynchronous I/O. A process executes the following code for (i = 0.com.com ( s < 0) Vb ( xb ) . (C) 2n (D) 2n+1 − 1 The total number of child processes created is (A) n (B) 2n − 1 © All rights reserved by GATE Forum Educational Services Pvt. Ltd.
IV.Q (R ) ∩ ΠP. III and IV (A) Only I and II (C) Only I. Catalog_ no. (B) 24. Which of the following statements is true? (A) Both Book and Collection are in BCNF (B) Both Book and Collection are in 3NF only (C) Book is in 2NF and Collection is in 3NF (D) Both Book and Collection are in 2NF only © All rights reserved by GATE Forum Educational Services Pvt. and Bits 011 are used as offset within the page The number of bits required for addressing the next level page table (or page frame) in the page table entry of the first. www. Consider the following relational schemes for a library database: Book ( Title. Year. II. Which of the following queries are equivalent? I.Q (R ) − ( ΠP.com A processor uses 36 bit physical addresses and 32 bit virtual addresses. III. Q. Author. Pr ice ) Collection ( Title. Ltd. Π P (R Π P (R ) S) ΠP ( S ) ΠP ( ΠP. II and III 69. following functional dependencies: Title Author → Catalog_no Catalog_no → Title Author Publisher Year Publisher Title Year → Pr ice Assume {Author. Each page table entry is of size 4 bytes.R3) S (P.gateforum. S1. Q} is the key for both schemas. 24 and 20 (D) 25. second and third level page tables are respectively (A) 20.R1. II. 20 and 20 68. Author. Discuss this questions paper at www. 25 and 24 Let R and S be two relations with the following schema R (P. Publisher.Q ( S ) ) ΠP ΠP.Q ( S ) ) ( ) (B) Only I and III (D) Only I. with a page frame size of 4 Kbytes. Title} is the key for both schemes. 24 and 24 (C) 24.Q (R ) − ΠP. Page 15 of 20 . A three level page table is used for virtual to physical address translation. Q.R2.gateforum. where the virtual address is used as follows • • • • Bits 3031 are used to index into the first level page table Bits 2129 are used to index into the second level page table Bits 1220 are used to index into the third level page table.com. Catalog_ no ) with in the I. S2 ) Where {P. III. No part of this booklet may be reproduced or utilized in any form without the written permission.CS GATE Paper 2008 67.
The only data memory references made by the program are those to array ARR 71. j < 1024. The cache is initially empty and no prefetching is done. j . i + + ) for ( j = 0. www. The file is stored in a file system with block size 1024 bytes. The cache is managed using 32 bit virtual addresses and the page size is 4Kbyts.com Consider a file of 16384 records. Page 16 of 20 . The total size of the tags in the cache directory is (A) 32Kbits 72. j + + ) ARR i j = 0. The cache hit ratio for this initialization loop is (A) 0% (B) 25% (C) 50% (D) 75% © All rights reserved by GATE Forum Educational Services Pvt. Ltd. Each record is 32 bytes long and its key field is of size 6 bytes. and a multilevel index scheme is used to store the secondary index.0 * / for (i = 0.CS GATE Paper 2008 70.i < 1024.gateforum. (B) 34Kbits (C) 64Kbits (D) 68Kbits Which of the following array elements has the same cache index as ARR [0] [0]? (A) ARR [0] [4] (B) ARR [4] [0] (C) ARR [0] [5] (D) ARR [5] [0] 73. /* Initialize array ARR to 0.gateforum.com.0. int i. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. A program to be run on this machine begins as follows: double ARR 1024 1024. and the file organization is unspanned. and the size of a block pointer is 10 bytes. the number of firstlevel and secondlevel blocks in the multilevel index are respectively (A) 8 and 0 (B) 128 and 6 (C) 256 and 4 (D) 512 and 5 Common Data for Questions: 71 72 and 73 Consider a machine with a 2way set associative data cache of size 64Kbytes and block size 16bytes. The size of double is 8Bytes. If the secondary index is built on the key field of the file. No part of this booklet may be reproduced or utilized in any form without the written permission. Discuss this questions paper at www. The file is ordered on a nonkey field.
X 0 = Y 0 = Z 0 = 0. i <= n.CS GATE Paper 2008 Common Data for Questions: 74 and 75 www. Z i = 3 * X i. X 1 = 1.gateforum.gateforum. No part of this booklet may be reproduced or utilized in any form without the written permission. The running time of f1 (n) and f2 (n) are (A) Θ (n) and Θ (n) (C) Θ (n) and Θ 2n (B) Θ 2n and Θ (n) (D) n ( ) ( ) Θ (2 ) and Θ (2 ) n 75.com. Z 1 = 3. } int f2 { int i. Y 1 = 2. F1 (8) and f2 (8) return the values (A) 1661 and 1640 (C) 1640 and 1640 (B) 59 and 59 (D) 1640 and 1661 © All rights reserved by GATE Forum Educational Services Pvt. Y N . int X N . for (i = 2. } n = = 1) ( int n ) ( int n ) 74. Z N. else return (2 * f1 (n − 1) + 3 * f1 (n − 2 ) ) . Ltd. Page 17 of 20 . i + + ) { X i = Y i − 1 + Z i − 2.com Consider the following C functions: int f1 { if (n = = 0 return n. } return X n. Discuss this questions paper at www. Y i = 2 * X i.
The value of x5 is (A) 5 (B) 7 (C) 8 (D) 16 Statement for Linked Answer Questions: 80 & 81 The subsetsum problem is defined as follows. irrespective of whether the condition evaluates to true or false (A) The instruction following the conditional branch instruction in memory is executed (B) The first instruction in the fall through path is executed (C) The first instruction in the taken path is executed (D) The branch takes longer to execute than any other instruction 77. No part of this booklet may be reproduced or utilized in any form without the written permission. Ltd.gateforum. I2. is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2dimensional Boolean array. with n rows and W+1 columns. a2 . © All rights reserved by GATE Forum Educational Services Pvt. I3 or I4 can legitimately occupy the delay slot without any other program modification? (A) I1 (B) I2 (C) I3 (D) I4 Statement for Linked Answer Questions: 78 & 79 Let xn denote the number of binary strings of length n that contain no consecutive 0s. and positive integer W.. Discuss this questions paper at www. Given a set of n positive integers.com... Page 18 of 20 . Which of the following recurrences does xn satisfy? (A) xn = 2xn−1 (B) xn = x n/2 +1 (C) xn = x n/2 +n (D) xn = xn −1 + xn−2 79. S = {a1 . an } . 78. The following code is to run on a pipelined processor with one branch delay slot: I1 : I2 : I3 : I4 : ADD R2 ← R7 + R8 SUB R4 ← R5 − R6 ADD R1 ← R2 + R3 STORE Memory R4 ← R1 BRANCH to Label if R1 = = 0 Which of the instructions I1.com Linked Answer Questions: Q.CS GATE Paper 2008 www. a3 .. For all delayed conditional branch instructions. X.gateforum.76 to 85 Carry Two Marks Each Statement for Linked Answer Questions: 76 & 77 Delayed branching can help in the handling of control hazards 76.
j = 9. j − ai 81.. The program is erroneous. j = X i − 1.1 ≤ i ≤ n. j = X i − 1. © All rights reserved by GATE Forum Educational Services Pvt.M3. N.com.. 0 (C) X n. j ∨ X i. 8. {a1 . j ∨ X i − 1. Page 19 of 20 . 3. is TRUE if and only if there is a subset of whose elements sum to j. ( Y k < x ) i = k. a2 . } if f (int Y 10 . The minimum number of tables needed to represent M. j = X i − 1. 7. 5.N1} (D) {M1.P1.P1} (B) {M1. j ∧ X i − 1.P1..gateforum. if TRUE. Discuss this questions paper at www.com X i.. j. No part of this booklet may be reproduced or utilized in any form without the written permission. implies that there is a subset whose elements sum to W? (A) X 1. j − ai (D) X i. Ltd. Which of the following is a correct attribute set for one of the tables for the correct answer to the above question? (A) {M1. 0 ≤ j ≤ W. i = 0. ( Y k = = x ) pr int f (" x is in the array ") .M2. ai } (B) X i. W (D) X n − 1.gateforum. 80. 9.else j = k. Which of the following is valid for 2 ≤ i ≤ n and ai ≤ j ≤ W ? (A) X i.N2} (C) {M1. int x ) { int u. j − ai Which entry of the array X. 1. 4. P. j ∧ X i. k. j = X i − 1. 10.n Statement for Linked Answer Questions: 82 & 83 Consider the following ER diagram M1 M2 M3 P1 P2 N1 N2 M R1 P R2 N 82.N1. if else pr int f (" x is not in the array ") . W (B) X n. j . 6. j − ai (C) X i. 2.CS GATE Paper 2008 www. R1. do { k = (i + j) / 2.P1} Statement for Linked Answer Questions: 84 & 85 Consider the following C program that attempts to locate an element x in an array Y[ ] using binary search. R2 is (A) 2 (B) 3 (C) 4 (D) 5 83. } while ( ( Y k ! = x ) & & (i < j) ) .
No part of this booklet may be reproduced or utilized in any form without the written permission.com. (B) Change line 6 to:if ( Y k < x ) i = k − 1. Discuss this questions paper at www. else j = k − 1. (D) Change line 7 to:} while ( ( Y k = = x ) & & (i < j) ) . The correction needed in the program to make it work properly is (A) Change line 6 to:if ( Y k < x ) i = k + 1. Page 20 of 20 . else j = k.gateforum. www.gateforum.com On which of the following contents of Y and x does the program fail? (A) Y is 1 2 3 4 5 6 7 8 9 10 and x < 10 (B) Y is 1 3 5 7 9 11 13 15 17 19 and x < 1 (C) Y is 2 2 2 2 2 2 2 2 2 2 and x > 2 (D) Y is 2 4 6 8 10 12 14 16 18 20 and 2 < x < 20 and x is even 85. Ltd. (C) Change line 6 to:if ( Y k < = x ) i = k.CS GATE Paper 2008 84. © All rights reserved by GATE Forum Educational Services Pvt. else j = k + 1.