0% found this document useful (0 votes)
85 views20 pages

Nodia and Company: Gate Solved Paper Computer Science Engineering 2008

Uploaded by

jaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views20 pages

Nodia and Company: Gate Solved Paper Computer Science Engineering 2008

Uploaded by

jaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

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.

GATE SOLVED PAPER


Computer Science Engineering
2008

Copyright © By NODIA & COMPANY

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
to render engineering or other professional services.

NODIA AND COMPANY


B-8, Dhanshree Tower Ist, Central Spine, Vidyadhar Nagar, Jaipur 302039
Ph : +91 - 141 - 2101150
www.nodia.co.in
email : [email protected]
GATE SOLVED PAPER - CS
2008

Q. 1 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) Q (n) (B) Q (m)
(C) Q (m + n) (D) Q (mn)

Q. 2 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

. i n
c o
a .
i
(A) MNOPQR (B) NQMPOR

d
(C) QMNPRO (D) QMNPOR

o
.n
Q. 3 Consider the following function;
f (n) = 2n g (n) = n!

w
logn
h (n) = n

w
Which of the following statements about the asymptotic behavior of f (n). g (n)
and h (n) is true?

w
(A) f (n) = O (g (n)); g (n) = O (h (n)) (B) f (n) = W (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) = W (f (n))

Q. 4
©
The minimum number of comparison required to determine if an integer appears
more than n/2 times in a sorted array of n integers is
(A) Q (n) (B) Q (log n)
(C) Q (log * n) (D) Q (1)

Q. 5 AB -tree 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

Q. 6 G is a graph on n vertices and 2n - 2 edges. The edges of G can be partitioned


into two edge-disjiont spanning trees. Which of the following is NOT true for G ?
(A) For every subset of k vertices, the induced sub graph has a most 2k - 2
edges.
(B) The minimum cut in G has a least two edges
(C) There are two edges-disjoint paths between every pair of vertices
(D) There are two vertex-disjoint paths between every pair of vertices.
GATE SOLVED PAPER - CS 2008

Q. 7 Consider the Quicksort algorithm. Suppose there is a procedure for finding a


pivot element which splits the list into sub-lists each of which contains at least
one-fifth 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

Q. 8 The subset-sum problem is defined as follows: Given a set S of n positive integers


and a positive integer W ; determine whether there is aa 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 sloves the subset-sum problem unpolynomial time when the input is
encoded in unary

in
(B) Q solves the subset-sum problem is polynominal time when the input is
encoded in binary
.
co
(C) The subset sum problem belongs to the class NP

.
(D) The subset sum problem in NP-hard

i a
Q. 9

o d
Dijkstra’s single source shortest path algorithm when run from vertex a in the
above graph, computes the corrects shortest path distance to

. n
w
w
w
©
(A) only vertex a (B) only vertices a, e, f, g, h
(C) only vertices,a, b, c, d (D) all the vertices

Q. 10 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) Q (log n)
(B) Q (n)
(C) Q (n log n)
(D) none of the above, as the tree cannot be uniquely determined.

Q. 11 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) Q (log n) (B) Q (n)
(C) Q (n log n) (D) Q (n2)
GATE SOLVED PAPER - CS 2008

Common Data For Q. 12 and 13:


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[1]=1;Y[1]=2;Z[1]=3;
for (i=2;i<=n;i++){
X[i]=Y[i-1]+Z[i-2];

in
Y[i]=2)X[i];

.
z[i]=3)X[i];

co
}
return X[n];

.
}
Q. 12

i a
The running time of f1 (n) and f2 (n) are

d
(A) Q (n) and Q (n) (B) Q (2") and O (n)

o
(C) Q (n) and Q (2") (D) Q (2") and Q (2")

.n
f1 (8) f2 (8) return the values
Q. 13

w
(A) 1661 and 1640

w
(B) 59 and 59
(C) 1640 and 1640

w
(D) 1640 and 1661

©
Statement Data For Q. 14 and 15:
The subset-sum problem is defined as follows. Given set of n positive integers,
S = {a1, a2, a3,....... an} and a positive integer W is there a subset S whose elements
sum of W ? A dynamic program for solving this problem uses a 2-dimensiond
Boolean array, X with n rows and W-1 columns X [i, j], 1 # i # W, is TRUE if and
only if there is a subset of {a1, a2,...... ai} whose elements sum to j .
Q. 14 Which of the following is valid for 2 # i # n and a1 # j # W?
(A) X [i, j] = X [i - 1, j] 0 X [i, j - ai]
(B) X [i, j] = X [i - 1, j] 0 X [i - 1, j - ai]
(C) X [i, j] = X [i - 1, j] / X [i, j - ai]
(D) X [i, j] = X [i - 1, j] / X [i - 1, j - ai]

Q. 15 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]
GATE SOLVED PAPER - CS 2008

Statement Data For Q. 16 and 17:


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(intY[10],intx){
2. inti,j,k;
3. i=0;j=9;
4. do {
5. k=(i+j)/2
6. if (Y[K]<x)i=k;elsej=k;
7. } while ((Y[k]!=x)&&(i<j)),
8. if (Y[k]==x) print f(“x is in the array”);
9. else printf(“x is not in the array”);
10. }

in
Q. 16 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

co
(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

a
(D) Y is [2 4 6 8 10 12 14 16 18 20] and 2 < x < 20 and x is even

Q. 17

d i
The correction needed in the program to make it work properly is

o
(A) change line 6 to : if (Y [k]) < x) i = k + 1; else j = k - 1;

. n
(B) change line 6 to: if (Y [k] < x) i = k - 1; else j = k + 1;

w
(C) change line 6 to: if (Y [k] < x) i = k; else j = k;

w
(D) change line 7 to : } while ((Y [k] == x)&&( i < j));

Q. 18

w
Which of the following describes a handle (as applicable to LR-parsing)

©
appropriately?
(A) It is the position in a sentential form where the next shift or reduce
operation will occur
(B) It is a non-terminal 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

Q. 19 Some code optimizations are carried out on the intermediate code because
(A) They enhance the portability of the complier to other target processors
(B) Program analysis is name accurate on intermediate code than on machine
code
(C) The information from data flow analysis cannot otherwise be used for
optimization
(D) The information from the front end cannot otherwise be used for
optimization
GATE SOLVED PAPER - CS 2008

Q. 20 Which of the following are true?


(i) A programming language option does not permit global variables of any king
and has no nesting of procedures/functions, but permits recursion can be
implemented with static storage allocation
(ii) Multi-level access link (or display) arrangement is needed to arrange
activation records-only if the programming language being implemented has
nesting of procedures/function
(iii) Recursion in programming languages cannot be implemented with dynamic
storage allocation
(iv) Nesting of procedures/functions and recursion require a dynamic heap
allocation scheme and cannot be implemented with a stack-based allocation
scheme for activation records
(v) Programming languages which permit a function to return a function as its
result cannot be implemented with a stack-based storage allocation scheme
for activation records
(A) (ii) and (v) only (B) (i), (iii) and (iv) only

. in
(C) (i), (ii) and (v) (D) (ii), (iii) and (v) only

co
Q. 21 An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and

.
only if

a
(A) The SLR(1) parser for G has S-R conflicts

d i
(B) The LR(1) parser for G has S-R conflicts
(C) The LR(0) parser for G has S-R conflicts

o
.n
(D) The LALR(1) parser for G has reduce-reduce conflicts

Q. 22 What is the maximum size of data that the application layer can pass on to the
TCP layer below?
w
w
(A) Any size (B) 216 bytes-size of TCP header

w
(C) 216 bytes (D) 1500 bytes

In the slow start phase of TCP congesting control algorithm, the size of the

©
Q. 23

congestion window
(A) Does not increase
(B) Increases linearly
(C) Increases quadratically
(D) Increases exponentially

Q. 24 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

Q. 25 A computer on a 10Mbps network is regulated by atoken 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
GATE SOLVED PAPER - CS 2008

Q. 26 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

Q. 27 For a magnetic disk with concentric circular track, the latency is not linearly
proportional to the seek distance due to

in
(A) non-uniform distribution of requests

.
co
(B) arm starting and stopping inertia
(C) higher capacity of tracks on the periphery of the platter

.
(D) use of unfair arm scheduling policies.

a
Q. 28

d i
Which of the following is/are true of the auto increment addressing mode?
1. It is useful in creating self relocating code

o
2. If it is included in an Instruction Set Architecture, then an additional ALU is

n
.
required for effective address calculation

w
3. The amount of increment depends on the size of the data item accessed.
(A) 1 only (B) 2 only
(C) 3 only
w (D) 2 and 3 only

Q. 29
w
Which of the following must be true for the RFE (Return from Expectation)

©
instruction on a general purpose processor.
1. It must be a trap instruction
2. It must be a privileged instruction
3. An exception can not be allowed to occur during execution of an RFE instruction.
(A) 1 only (B) 2 only
(C) 1 and 2 only (D) 1, 2 and 3 only

Q. 30 For inclusion to hold between two cache level L1 and L2 in a multilevel cache
hierarchy, which of the following are necessary?
1. L1 must be a write-through cache
2. L2 must be write-through cache
3. The associativity of L2 must be greater that of L1
4. The L2 cache must be at least as large as the L1 cache
(A) 4 only (B) 1 and 2 only
(C) 1, 2 and 4 only (D) 1, 2, 3 and 4

Q. 31 Which of the following are NOT true in a pipe lined processor?


1. Bypassing can handle alll Raw hazards.
2. Register renaming can eliminate all register carried WAR hazards.
3. Control hazard penalties can be eliminated by dynamic branch prediction.
(A) 1 and 2 only (B) 1 and 3 only
(C) 2 and 3 only (D) 1,2 and 3
GATE SOLVED PAPER - CS 2008

Q. 32 The use of multiple register windows with overlap causes a reduction in the
number of memory accesses for
1. Function locals and parameters
2. Register saves and restores
3. Instruction fetches
(A) 1 only (B) 2 only
(C) 3 only (D) 1,2 and 3

Q. 33 In an instruction execution pipeline, the earliest that the data TLB (Translation
Look aside 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

in
Common Data For Q. 34, 35 and 36

.
Consider a machine a 2-way set associative data cache of size 64 kbytes and block

co
size 16 bytes. The cache is managed using 32 bit virtual addressed and the page
size is 4 kbytes. A program to be run on this machine begins as follows:
Double APR[1024]]1024]

a .
i
int i , j ;

d
/*Initalize array APR to 0.0*/

o
for (i = 0; i < 1024; i ++)

.n
for (j = 0; k < 1024; j ++)
APR[i] [j] = 0.0;

w
The size of double 8 bytes. Array APR is in memory stating at the beginning of
virtual page 0 # FF000 and stored in row major order. The cache is initially

w
empty and no pre-fetching is done. The only data memory references made by the

w
program are those to array APR.

©
Q. 34 The total size of the tags in the cache directory is
(A) 32 kbits
(B) 34 kbits
(C) 64 kbits
(D) 68 kbits

Q. 35 Which of the following array elements has the same cache index as APR [0][0]?
(A) APR[0][4]
(B) APR[4][0]
(C) APR[0][5]
(D) APR[5][0]

Q. 36 The cache hit ratio for this initialization loop is


(A) 0% (B) 25%
(C) 50% (D) 75%
GATE SOLVED PAPER - CS 2008

Common Data For Q. 37 and 38


Delayed branching can help in the handling of control hazardous
Q. 37 For all delayed conditional branch instruction, irrespective of weather the condition
evato true or false, A
(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 that any other instruction

Q. 38 The following code is to run on a pipe lined processor with one branch delay slot
11: ADD R2 ! R7+R8
12: SUB R4 ! R5- R6

in
13: ADD R1 ! R2+ R3
14: STORE Memory [R4] ! R1
.
co
BRANCH to Label if R1==0

.
Which of the instruction 11,12,13 or 14 can legitimately occupy the delay slot

a
without any other program modification?

i
(A) 11 (B) 12
(C) 13

o d (D) 14

n
Q. 39 A clustering index is defined on the fields which are of type

.
(A) Non-key and ordering (B) Non-key and non-ordering

w
(C) key and ordering (D) Key and non-ordering

Q. 40

w
Let R and S be two relations with the following schema

w
R (P, Q, R1, R2, R3)
S (P, Q, S1, S2)

©
Where {P, Q} is the key for both schemes. Which of the following queries are
equivalent?
I. PP (D S) II. PP (R) D PP (S)
III. PP (PP, Q (R) + PP, Q (S)) IV. PP (PP, Q (R) - (PP, Q (R) - PP, Q (S)))
(A) Only I and II (B) Only I and II
(C) Only I, II and III (D) Only I, II and IV

Q. 41 Consider the following relational schemes for a library database:


Book (Title, Author, Catalog_no, Publisher, Year, price)
Collection (Title, Author, Catalog_no)
Which the following functional dependencies:
I. Title Author "Catalog_no
II. Catalog_no "Title Author Publisher Year
III. Publisher Title Year"price
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
GATE SOLVED PAPER - CS 2008

Q. 42 Consider a file of 1684 records. Each record is 32 bytes long and its key field is
of size 6 bytes. The file is ordered on a non-key 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 multi-level index scheme is used to store the secondary
index, the number of first-level and second-level blocks in the multi-level index
are respectively
(A) 8 and 0 (B) 128 and 6
(C) 256 and 4 (D) 512 and 5

Common Data For Q. 43 and 44


Solve the problems and choose the correct answers.
Consider the following ER diagram

. in
co
Q. 43 The minimum number of tables needed to represent M, N, P, R1, R2 is

.
(A) 2 (B) 3

a
(C) 4 (D) 5

Q. 44

d i
Which of the following is a correct attribute set for one of the tables for the

o
correct answer to the above question?

.n
(A) {M1,M2,M3,P1} (B) {M1,P1,N1,N2}
(C) {M1,P1,N1} (D) {M1,P1}

Q. 45
w
In the IEEE floating point representation the hexadecimal value 0x00000000
corresponds to
w
w
(A) the normalized value 2- 127
(B) the normalized value 2- 126

©
(C) the normalized value + 0
(D) the special value + 0

Q. 46 In the karnaugh map shown below, X denoted a don’t care term. What is the
nominal 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
GATE SOLVED PAPER - CS 2008

Q. 47 Let a denote number system radix. The only value(s) of r that satisfy the equation
121 + 11, is/are
(A) decimal 10 (B) decimal 11
(C) decimal 10 and 11 (D) any value> 2

Q. 48 Give f1, f3 and f in canonical sum of products form (in decimal) for the circuit

f1 = /m (4, 5, 6, 7, 8)
f3 = /m (1, 6, 15)

in
f = /m (1, 6, 8, 15)

.
Then f2 is

co
(A) / m (4, 6) (B) / m (4, 8)

a.
(C) / m (6, 8) (D) / m (4,6,8)

i
- - - - -
Q. 49 If P , Q , R are Boolean variables, (P + Q) (P.Q + P.R) (P.R + Q) simplifies to

d
- -
(A) P.Q (B) P.R

o
- -
(C) P.Q + R (D) P.R + Q

Q. 50
. n
Which of the following tuple relational calculus expression(s) is/are equivalent to

w
6t ! r (P (t))

w
1. J7t ! r (P (t)) 2. 7t g r (P (t))
3. J7t g r (JP (t)) 4. 7t g r (JP (t))
(A) 1 only
w (B) 2 only

©
(C) 3 only (D) 3 and 4 only

Q. 51 If P, Q, R are subsets of the universal setU , then (P + Q + R) , (Pc + Q + R) , Qc , Rc


is
(A) Qc , Rc (B) P , Qc , Rc
(C) Pc , Qc , Rc (D) U

Q. 52 The following system of equations


x1 + x2 + 2x 3 = 1
x1 + 2X 3 + 3X 3 = 2
X1 + 4X2 + ax 3 = 4
has a unique solution. The only possible value (s) for a is/are
(A) 0 (B) either 0 or 1
(C) one of 0, 1 or - 1 (D) any real number other than 5

Q. 53 lim x - sin x equals


x"3 x + cos x
(A) 1 (B) - 1
(C) 3 (D) - 3
GATE SOLVED PAPER - CS 2008

Q. 54 Let fsa and pda be two predicates such that fsa(x) means x is a finite state
automation, and pda(y) means, that y is a pushdown automation. Let equivalent
be another predicate such that equivalent (a, b) means aa and b are equivalent.
Which of the following first order logic statement represents the following:
Each finite state automation has an equivalent pushdown automation.
(A) (6x fsa (x)) & (7y pda(y) / equivalent(x, y))
(B) - 6y fsa (x) & (7y pda(y) / equivalent(x, y))
(C) (6x7y (fsa( x) / pda (y)) / equivalent(x, y))
(D) (6x7y (fsa( x) / pda(x) / equivalent(x, y))

Q. 55 P and Q are two propositions. Which of the following logical expression are
equivalent?
1. P 0 ~Q
2. ~(~ P / Q)
3. (P / Q) 0 (P / ~Q) 0 (~P / ~Q)
4. (P / Q) 0 (P / ~Q) 0 (~P / Q)

in
(A) Only 1 and 2 (B) Only 1, 2 and 3

.
(C) Only 1, 2 and 4 (D) All of 1, 2, 3, and 4

co
Q. 56 Aishwarya studies either computer science or mathematics everyday. if she studies

.
computer science on a day, then the probability that she studies mathematics the

a
next day is 0.6. If she studies mathematics on a day, then the probability that

d i
she 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?
o
.n
(A) 0.24 (B) 0.36

w
(C) 0.40 (D) 0.60

w
Q. 57 Let X be a random variable following normal distribution with mean + land
variance 4. Let Y be another normal variable with mean- 1 and variance unknown,

(A) 3 w
If P (X # - 1) = P (Y $ 2) the standard deviation of Y is
(B) 2

Q. 58
(C)

Let
© 2

p= / i and Q = / i,
(D) 1

1 # i # 2k 1 # i # 2k
i odd i evene

where k is positive integer. Then


(A) P = Q - k (B) P = Q + k
(C) P = Q (D) P = Q + 2k

Common Data For Q. 59 and 60


Solve the problems and choose the correct answers.
Let xn denote the number of binary strings of length n that contain no consecutive
so.
Q. 59 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
GATE SOLVED PAPER - CS 2008

Q. 60 The value of x5 is
(A) 5 (B) 7
(C) 8 (D) 16

Q. 61 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 vertex-cover of size at most 3n/4
(D) The graph has an independent set of size at least n/3

Q. 62 How many of the following matrices have an eigenvalue 1?


1 0 0 1 1-1 -1 0
= G. = G. = G and = G
00 00 1 1 1-1

in
(A) one (B) two

.
(C) three (D) four

co
Q. 63 The minimum Number of equal length subintervals needed to approximater

.
2
# xex dx to an accuracy of at least 13 # 10- 6 using the trapezoidal rule is

i a
1

d
(A) 1000e (B) 1000

o
(C) 100e (D) 100

Q. 64

. n
The Newton-Raphson iteration xn + 1 = 1 cxn + R- m can be used to compute the
2

w
xn

w
(A) square of R (B) reciprocal of R
(C) square root of R (D) logarithm of R

Q. 65
w
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 extreme for the curve 3x 4 - 16x3 - 24x2 + 37 is
(A) 0 (B) 1
(C) 2 (D) 3

Q. 66 Which of the following system calls results in the sending of SYN packets?
(A) socket (B) bind
(C) listen (D) connect

Q. 67 The data block 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. 68 The P and V operations on counting semaphores, where s is a counting ewmaphore,


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 Pb and Vb the wait and signal operations on binary semaphores are
provided. Two binary semaphores Xb and Yb are used to implement the semaphore
operations P (s) and V (s) as follows:
GATE SOLVED PAPER - CS 2008

P(s):Pb(Xb);
s=s-1;
if (s<0){
Vb(Xb);
Pb(Yb);
}
else Vb(Xb);
P(s):Pb(Xb);
s=s+1;
if (s<=0){
Vb(Yb);
Vb(Xb);
The initial values of xb and yb are respectively
(A) 0 and 0 (B) 0 and 1
(C) 1 and 0 (D) 1 and 1

Q. 69 Which of the following statements about synchronous and asynchronous I/O is

in
NOT true?

.
(A) An ISR is invoked on completion of I/O in synchronous I/O but not in

co
asynchronous I/O

.
(B) In both synchronous and asynchronous I/O an ISR (Interrupt Serive

a
Routine) is invoked after completion of the I/O

d i
(C) A process making a synchronous I/O cal waits until I/O is complete, but a
process making an asynchronous I/O call does not wait for completion of

o
the I/O

.n
(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 afterr the completion of I/O

w
w
Q. 70 Which of the following is NOT true of deadlock prevention and deadlock avoidance
schemes?

w
(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
resulting state is safe
(C) Deadlock avoidance is less restrictive than deadlock prevention
(D) Deadlock avoidance requires knowledge of resource requirements a priori

Q. 71 A process executes the following code for(i = 0' i < n; i ++)fork();


The total number of child processes created is
(A) n (B) 2n - 1
(C) 2n (D) 2n + 1 - 1

Q. 72 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 30-31 are used to index into the first level page table,
: bits 21-29 are used to index into second level page table
: bits 12-20 are used to index into third level page table
GATE SOLVED PAPER - CS 2008

: bits 0-11 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 table are
respectively.
(A) 20,20 and 20 (B) 24,24 and 24
(C) 24,24 and 20 (D) 25,25 and 24

Q. 73 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

What is printed by the following C program?

in
Q. 74

.
int f(int x, int *py, int **ppz) void main()

co
{
int y,z;

.
**ppz+=1;z=*ppz;

a
*py+=2;y=*py;
x+=3;
return x+y+z;
d i
o
{

. n
int c,*b,**a;
c=4;b=&c;a=&b;

w
printf (“%d”,f(c,b,a));

w
(A) 18 (B) 19
(C) 21 (D) 22

Q. 75
w
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 reverse (void) {
int c;
if(?1) reverse();
?2
}
main () {
printf(“Enter Text”); printf(“/n”);
reverse(); printf(“/n”);
}
(A) ?1 is (getchar () ! = '\n')
?2 is getchar (c);
(B) ?1 is (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);
GATE SOLVED PAPER - CS 2008

Q. 76 The following C function takes a singly-linked 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;

in
q=p?p-> next : 0 ;

.
}

co
}
(A) 1,2,3,4,5,6,7

.
(B) 2,1,4,3,6,5,7

i a
(C) 1,3,2,5,4,7,6

d
(D) 2,3,4,5,6,7,1

Q. 77

o
Which of the following in true for the language{aP | P is a prime}?

.n
(A) It is not accepted by a Turning Machine

w
(B) It is regular but not context-free
(C) It is context-free but not regular

w
(D) It is neither regular nor context-free, but accepted by a Turing machine

Q. 78
w
Which of the following are decidable?

©
1. Whether the intersection of two regular languages is infinite
2. Whether a given context-free language is regular
3. Whether two push-down automata accept the same language
4. Whether a given grammar is context-free
(A) 1 and 2 (B) 1 and 4
(C) 2 and 3 (D) 2 and 4

Q. 79 If L and L are recursively enumerable then L is


(A) regular (B) context-free
(C) context-sensitive (D) recursive

Q. 80 Which of the following statements is false?


(A) Every NFA can be converted to an equivalent DFA
(B) Every non-deterministic Turing machine can be converted to an equivalent
deterministic Turing machine
(C) Every regular language is also a context-free language
(D) Every subset of a recursively enumerable set is recursive
GATE SOLVED PAPER - CS 2008

Q. 81 Given below are two finite state automata("indicates the start and F indicates
a final state)
Y: Z:
a b a b
" 1 2 " 2 2
2F 2 1 2F 1 1

(A) (B)
a b a b
-P S R -P S Q
Q R S Q R S
R(F) Q P R(F) Q P

in
S Q P S Q P

.
(C) (D)

co
a b a b

.
-P Q S -P S Q

a
Q R S Q S R

i
R(F) Q P R(F) Q P
S Q P

o d S Q P

Q. 82

. n
Which of the following statements are true ?

w
1. Every left-recursive grammar can be converted to a right-recursive grammar
and vice-versa

w
2. All e-productions can be removed from any context-free grammar by

w
suitable transformations
3. The language generated by a context-free grammar all of whose production

© are of the form X " w or X " wY (where, w is a staring of terminals and Y


is a non-terminal), is always regular
4. The derivation trees of strings generated by a context-free grammar in
Chomsky Normal Form are always binary trees.
(A) 1, 2, 3 and 4 (B) 2, 3 and 4 only
(C) 1, 3 and 4 only (D) 1, 2 and 4 only

Q. 83 Match List-I with List-II and select the correct answer using the codes given
below the lists:
List-I List-II
A. Checking that identifiers are 1. L = {a"b"c"d"| n # 1, m # 1}
declared before their use
B. Number of formal parameters in the 2. X " XbX | XcX | dXf | g
declaration to a function agress with
the number of actual parameters in
a use of that function
C. Arithmetic expressions with 3. L = {wcw | w ! (a | b)*}
matched pairs of parentheses
D. Palindromes 4. X " bXb | cXc | e
GATE SOLVED PAPER - CS 2008

Codes:
A B C D
(A) 1 3 2 4
(B) 3 1 4 2
(C) 3 1 2 4
(D) 1 3 4 2
Q. 84 Match List I with List II and select the correct answer using the codes given
below the lists:

. in
. co
i a
o d
.n
w
w
w
©
GATE SOLVED PAPER - CS 2008

Code:
a b c d
(A) 2 1 3 4
(B) 1 3 3 4
(C) 1 2 3 4
(D) 3 2 1 4

Q. 85 Which of the following are regular sets?


1. {an b2m | n # 0, m # 0}
2. {an bm | n = 2m}
3. {an bm | n ! m}
4. {xcy | x, y ! {a, b}*}

in
(A) 1 and 4 only (B) 1 and 3 only
(C) 1 only
.
(D) 4 only

. co
a
**********

d i
n o
.
w
w
w
©
GATE SOLVED PAPER - CS 2008

ANSWER KEY
2008
1 2 3 4 5 6 7 8 9 10
(C) (A) (A) (B) (C) (A) (C) (D) (B) (C)
11 12 13 14 15 16 17 18 19 20
(B) (C) (*) (D) (B) (A) (B) (D) (B) (B)
21 22 23 24 25 26 27 28 29 30
(B) (B) (D) (C) (B) (C) (C) (C) (D) (A)
31 32 33 34 35 36 37 38 39 40
(D) (C) (B) (B) (B) (C) (B) (B) (A) (C)
41 42 43 44 45 46 47 48 49 50
(C) (C) (A) (A) (D) (A) (D) (C) (A) ()
51 52 53 54 55 56 57 58 59 60

in
() () () () () () () () () ()
61 62 63 64 65 66
.
67 68 69 70

co
() () () () () (D) (D) (C) (B) (C)
71 72 73 74 75 76

a . 77 78 79 80

i
(B) (B) (A) (B) (D) (B) (D) (B) (D) (D)
81
(A)
82
(C)
83
(C)
84
(C)
85

o d
(A)

.n
w
w
w
©

You might also like