Ya Y Ya Y2 Ya Y A Y2: Common Data For Questions 3 & 4
Ya Y Ya Y2 Ya Y A Y2: Common Data For Questions 3 & 4
Ya Y Ya Y2 Ya Y A Y2: Common Data For Questions 3 & 4
CS 1/19
www.gatehelp.com
Question. 1
Two alternative package Aand Bare available for processing a database having 10
k
re-
cords. Package A requires 0.0001 n
2
time units and package B requires 10 log n n
10
time
units to process n records. What is the smallest value of k for which package B will be
preferred over A ?
(A) 12 (B) 10
(C) 6 (D) 5
Question. 2
The weight of a sequence , ......, a a a
n 0 1 1
of real numbers is defined as / ...... / a a a 2 2
n
n
0 1 1
1
+ +
. A subsequence of a sequence is obtained by deleting some elements form the sequence,
keeping the order of the remaining elements the same. Let X denote the maximum pos-
sible weight of a subsequence of , , ....... a a a
n 0 1 1
and Y the maximum possible weight of a
subsequence of , , ......., a a a
n 1 2 1
. Then X is equal to
(A) max ( , ) Y a Y
0
+ (B) max ( , / ) Y a Y 2
0
+
(C) max ( , ) Y a Y 2
0
+ (D) / a Y 2
0
+
Common Data for Questions 3 & 4
Consider a complete undirected graph with vertex set {0, 1, 2, 3, 4}. Entry W
ij
in the ma-
trix W below is the weight of the edge { , } i j .
W
0
1
8
1
4
1
0
12
4
9
8
12
0
7
3
1
4
7
0
2
4
9
3
2
0
=
J
L
K
K
K
K
K
K
N
P
O
O
O
O
O
O
Question. 3
What is the minimum possible weight of a spanning tree T in this graph such that vertex
0 is a leaf node in the tree T ?
(A) 7 (B) 8
2010 CS
CS 2/19
www.gatehelp.com
(C) 9 (D) 10
Question. 4
What is the minimum possible weight of a path P from vertex 1 to vertex 2 in this graph
such that P contains at most 3 edges ?
(A) 7 (B) 8
(C) 9 (D) 10
Question. 5
What data structure in a complier is used for managing information about variables and
their attributes?
(A) Abstract syntax tree (B) Symbol table
(C) Semantic stack (D) Parse table
Question. 6
Which languages necessarily need heap allocation in the runtime environment ?
(A) Those that support recursion
(B) Those that use dynamic scoping
(C) Those that allow dynamic data structure
(D) Those that use global variables
Question. 7
The grammar S "aSA|bS|c is
(A) LL (1) but not LR (1) (B) LR (1) but not LL(1)
(C) Both LL (1) and LR (1) (D) Neither LL (1) nor LR (1)
Question. 8
One of the header fields in an IP datagram is the Time-to-Live (TTL) field. Which of the
following statements best explains the need for this field ?
2010 CS
CS 3/19
www.gatehelp.com
(A) It can be used to prioritize packets
(B) It can be used to reduce delays
(C) It can be used to optimize throughput
(D) It can be used to prevent packet looping
Question. 9
Which one of the following is not a client-server application ?
(A) Internet chat (B) Web browsing
(C) E-mail (D) Ping
Question. 10
Suppose computers A and B have IP addresses 10.105.1.113 and 10.105.1.91 respectively
and they both use the same netmask N. Which of the values of N given below should not
be used if A and B should belong to the same network ?
(A) 225.255.255.0 (B) 255.255.255.128
(C) 255.255.255.192 (D) 255.255.255.224
Statement for Linked Answer Questions 11 & 12
Consider a network with 6 routers R1 and R6 connected with links having weights as
shown in the following diagram.
Question. 11
All the routers use the distance vector based routing algorithm to update their routing
2010 CS
CS 4/19
www.gatehelp.com
tables. Each starts with its routing table initialized to contain an entry for each neighbour
with the weight of the respective connecting link. After all the routing tables stabilize, how
many links in the network will never be used for carrying any data ?
(A) 4 (B) 3
(C) 2 (D) 1
Question. 12
Suppose the weights of all unused links in the previous question are changed to 2 and the
distance vector algorithm is used again until all routing tables stabilize. How many links
will now remain unused ?
(A) 0 (B) 1
(C) 2 (D) 3
Question. 13
A main memory unit with a capacity of 4 megabytes is build using 1 1 M bit DRAM
#
chips. Each DRAM chip has 1K rows of cells with 1 K cells in each row. The time taken
for a single refresh operation is 100 nanoseconds. The time required to perform one refresh
operation on all the cells in the memory unit is
(A) 100 nanoseconds (B) 100 2
10 )
nanoseconds
(C) 100 2
20 )
nanoseconds (D) 3200 2
20 )
nanoseconds
Question. 14
A-5 stage pipelined processor has Instruction Fetch. (IF), Instruction Decode (ID), Oper-
and Fetch (OF), Perform Operation (PO) and Write Operand (WO) stages. The IF, ID,
OF and WO stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock
cycle for ADD and SUB instruction. The PO stage takes 1 stake clock cycle for ADD and
SUB instructions 3 clock cycles for MUL instruction, and 6 clock cycles for DIV instruc-
tion respectively. Operand forwarding is used in the pipeline. What is the number of clock
cycles needed to execute the following sequence of instructions ?
Instruction Meaning of instruction
I
0
: MUL , , R R R
2 0 1
R R R
2 0 1
!
)
2010 CS
CS 5/19
www.gatehelp.com
I
1
: DIV , , R R R
5 3 4
/ R R R
5 3 4
!
I
2
: ADD , , R R R
2 5 2
R R R
2 5 2
! +
I
3
: SUB , , R R R
5 2 6
R R R
5 2 6
!
(A) 13 (B) 15
(C) 17 (D) 19
Question. 15
The program below uses six temporary variables , , , , , a b c d e f
a 1 =
b 10 =
c 20 =
d a b = +
e c d = +
f c e = +
b c e = +
e b f = +
d e 5 = +
Assuming that all operations take their operands from register, what is the minimum num-
ber of registers needed to execute this program without spilling ?
(A) 2 (B) 3
(C) 4 (D) 6
Common Data for Questions 16 & 17
A computer system has an L1 and L2 cache, an L2 cache, and a main memory unit con-
nected as shown below. The block size in L1 cache is 4 words. The block size is L2 cache
is 16 words. The memory access times are 2 nanoseconds, 20 nanoseconds and 200 nano-
seconds for L1 cache, L2 cache and main memory unity respectively.
2010 CS
CS 6/19
www.gatehelp.com
Question. 16
When there is a miss in L1 cache and a hit in L2 cache, a block is transferred form L2
cache to L1 cache. What is the time taken for this transfer ?
(A) 2 nanoseconds (B) 20 nanoseconds
(C) 22 nanoseconds (D) 88 nanoseconds
Question. 17
When there is a miss in both L1 cache and L2 cache, first a block is transferred from
memory to L2 cache, and then a block is transferred from L2 cache to L1 cache. What is
the total time taken for these transfers ?
(A) 222 nanoseconds (B) 888 nanoseconds
(C) 902 nanoseconds (D) 968 nanoseconds
Question. 18
Consider a B
+
-tree in which the maximum number of keys in a node is 5. What is the
minimum number of keys in any non-root node?
(A) 1 (B) 2
(C) 3 (D) 4
Question. 19
A relational schema for a train reservation database is given below.
Passenger (pid, pname, age)
Reservation (pid, class, tid)
Table : passenger
pid pname Age
0 Sachin 65
2010 CS
CS 7/19
www.gatehelp.com
1 Rahul 66
2 Sourav 67
3 Anil 69
Table : Reservation
pid class tid
0 AC 8200
1 AC 8201
2 SC 8201
3 AC 8203
4 SC 8204
5 AC 8202
What pids are returned by the following SQL query for the above instance of the tables ?
SELECT pid
FROM Reservation
WHERE class= AC AND
EXISTS (SELECT
)
FROM Passenger
WHERE age>65 AND
Passenger.pid = Reservation.pid)
(A) 1,0 (B) 1, 2
(C) 1, 3 (D) 1, 5
Question. 20
Which of the following concurrency control protocols ensure both conflict serializability
and freedom from deadlock?
I. 2-phase locking
II Time-stamp ordering
(A) I only (B) II only
(C) Both I and II (D) Neither I nor II
2010 CS
CS 8/19
www.gatehelp.com
Question. 21
Consider the following schedule for transactions T1, T2, and T3 :
T1 T2 T3
Read (X)
Read (Y)
Read (Y)
Write (X)
Write (X)
Read (X)
Write (X)
Which one of the schedules below is the correct serialization of the above ?
(A) T T T 1 3 2 " " (B) T T T 2 1 3 " "
(C) T T T 2 3 1 " " (D) T T T 3 1 2 " "
Question. 22
The following functional dependencies hold for relations R(A,B,C) and S(B,D,E):
B A "
A C "
The relation R contains 200 tuples and the relation S contains 100 tuples. What is the
maximum number of tuples possible in the natural join R S D ?
(A) 100 (B) 200
(C) 300 (D) 2000
Question. 23
The minterm expansion of ( , , ) f P Q R PQ QR PR = + + is
(A) m m m m
2 4 6 1
+ + + (B) m m m m
0 1 3 5
+ + +
(C) m m m m
0 1 6 1
+ + + (D) m m m m
2 3 4 5
+ + +
2010 CS
CS 9/19
www.gatehelp.com
Question. 24
P is a 16-bit signed integer. The 2s complement representation of P is ( ) F B 87
16
. The 2s
complement representation of P 8
)
is
(A) ( ) C D 3 8
16
(B) ( ) B 187
16
(C) ( ) F878
16
(D) ( ) B 987
16
Question. 25
The Boolean expression for the output f of the multiplexer shown below is
(A) P Q R 5 5 (B) P Q R 5 5
(C) P Q R + + (D) P Q R + +
Question. 26
What is the boolean expression for the output f of the combinational logic circuit of NOR
gates given below ?
(A) Q R + (B) P Q +
2010 CS
CS 10/19
www.gatehelp.com
(C) P R + (D) P Q R + +
Question. 27
In the sequential circuit shown below, if the initial value of the output Q Q
1 0
is 00, what
are the next four values of Q Q
1 0
?
(A) 11, 10, 01, 00 (B) 10, 11, 01, 00
(C) 10, 00, 01, 11 (D) 11, 10, 00, 01
Question. 28
Let ( , ) G V E = be a graph. Define ( ) , G i d
d
d
#
= / where i
d
is the
number of vertices of degree d in G. If S and T are two different trees with ( ) ( ) S T =
, then
(A) S T 2 = (B) S T 1 =
(C) S T = (D) S T 1 = +
Question. 29
Newton-Raphson method is used to compare a root of the equation x 13 0
2
= with 3.5
as the initial value. The approximation after one iteration is
(A) 3.575 (B) 3.677
(C) 3.667 (D) 3.607
Question. 30
What is the possible number of reflexive relations on a set of 5 elements ?
2010 CS
CS 11/19
www.gatehelp.com
(A) 2
10
(B) 2
15
(C) 2
20
(D) 2
25
Question. 31
Consider the set { , , } S 1
2
= , where and
2
are cube roots of unity. If * denotes the
multiplication operation, the structure {S, *} forms
(A) a group (B) a ring
(C) an integral domain (D) a field
Question. 32
What is the value of lim
n
1
1
n
n 2
"3
b l
?
(A) 0 (B) e
2
(C) ( )/ n 1 2 (D) 1
Question. 33
In a binary tree with n nodes, every node has an odd number of descendants. Every node
is considered to be its own descendant. What is the number of nodes in the tree that have
exactly one child ?
(A) 0 (B) 1
(C) ( )/ n 1 2 (D) n 1
Question. 34
Consider a company that assembles computers. The probability of a faulty assembly of any
computer is p. The company therefor subjects each computer to a testing process. This
testing process gives the correct result for any computer with a probability of q. What is
the probability of a computer being declared faulty ?
(A) ( )( ) pq p q 1 1 + (B) ( ) q p 1
(C) ( ) p q 1 (D) pq
2010 CS
CS 12/19
www.gatehelp.com
Question. 35
What is the probability that a divisor of 10
99
is a multiple of 10
96
?
(A) 1/625 (B) 4/625
(C) 12/625 (D) 16/625
Question. 36
The degrees sequence of a simple graph is the sequence of the degrees of the nodes in the
graph in decreasing order. Which of the following sequence can not be the degree sequence
of any graph ?
I 7, 6, 5, 4, 4, 3, 2, 1
II 6, 6, 6, 6, 3, 3, 2, 2
III 7, 6, 6, 4, 4, 3, 2, 2
IV 8, 7, 7, 6, 4, 2, 1, 1
(A) I and II (B) III and IV
(C) IV only (D) II and IV
Question. 37
Consider the following matrix.
A
X Y
2 3
=> H
If the eigenvalues of A are 4 and 8, then
(A) , x y 4 10 = = (B) , x y 5 8 = =
(C) , x y 3 9 = = (D) , x y 4 10 = =
Question. 38
Suppose the predicate ( , , ) F x y t is used to represent the statement that person x can fool
person y at time t .Which one of the statements below expresses best the meaning of the
formula ( ( , , )) x y t F x y t 6 7 7 J ?
2010 CS
CS 13/19
www.gatehelp.com
(A) Everyone can fool some person at some time
(B) No one can fool everyone all the time
(C) Everyone cannot fool some person all the time
(D) No one can fool some person at some time.
Question. 39
Consider the methods used by processes P1 and P2 for accessing their critical sections
whenever needed, as given below. The initial values of shared boolean variables S1 and S2
are randomly assigned.
Method used by P1 Method used by P2
While (S1==S2);
Critical Section
S1=S2;
While (S1!=S2);
Critical Section
S2=not (S1)
While one of the following statements describes properties achieved ?
(A) Mutual exclusion nut nor progress
(B) Progress but not mutual exclusion
(C) Neither mutual exclusion nor progress
(D) Both mutual exclusion and progress
Question. 40
A system uses FIFO policy for page replacement. It has 4 page frames with no pages load-
ed to begin with . The system first accesses 100 distinct pages in some order and then ac-
cesses the same 100 pages but now in the reverse order .How many page faults will occur ?
(A) 196 (B) 192
(C) 197 (D) 195
Question. 41
Which of the following statements are true ?
I Shortest remaining time first scheduling may cause starvation
II Preemptive scheduling may cause starvation
2010 CS
CS 14/19
www.gatehelp.com
II Round robin in better than FCFS in terms of response time
(A) I only (B) I and III only
(C) II and III only (D) I, II and III
Question. 42
The following program consists of 3 concurrent precesses and 3 binary semaphores. The
semaphores are initialized as 1, 0, 0 S S S
0 1 2
= = =
Process P
0
Process P
1
Process P
2
While (true){
wait (S
0
);
print 0
release (S
1
);
release (S
2
);
}
wait (S
1
);
release (S
0
);
wait (S
2
)
release (S
0
);
How many times will precess P0 print 0 ?
(A) At least twice (B) Exactly twice
(C) Exactly thrice (D) Exactly once
Question. 43
A system has n resources R ..R
0 n 1 -
, and k processes P ..P
0 k 1 -
.The implementation of the
resource request logic of each process P
i
, is as follows:
if (i%2==0){
if(i<n)requestR
i
;
if(i+2<n)request T
i 2; +
}
else {
if (i<n)request R ;
n 1 -
if (i+2<n)requestR ;
n i 2 - -
}
In which one of the following situations is a deadlock possible ?
(A) , n k 40 26 = = (B) , n k 21 12 = =
2010 CS
CS 15/19
www.gatehelp.com
(C) , n k 20 10 = = (D) , n k 41 19 = =
Question. 44
The cyclomatic complexity of each of the modules A and B shown below is 10. What is the
cyclomatic complexity of the sequential integration shown on the right hand side ?
(A) 19 (B) 21
(C) 20 (D) 10
Question. 45
What does the following program print ?
#include<stdio.h>
void f(int *p, int *q){
p q; =
p 2; =
)
}
int i=0,j=1;
int main(){
f(&i,&j);
printf(%d%d\n,i,j);
return 0;
}
(A) 22 (B) 21
(C) 01 (D) 02
Question. 46
What is the appropriate paring of items in the two columns listing various activities en-
countered in a software life cycle ?
2010 CS
CS 16/19
www.gatehelp.com
P. Requirement Capture
Q. Design
R. Implementation
S. Maintenance
1. Module Development and
Integration
2. Domain Analysis
3. Structural and Behavioral
Modeling
4. Performance Tuning
(A) P-3 Q-2, R-4 S-1 (B) P-2 Q-3 R-1 S-4
(C) P-3 Q-2 R-1 S-4 (D) P-2 Q-3 R-4 S-1
Question. 47
What is the value printed by the following C program ?
#include<stdio.h>
int f(int *a, int n)
{
if (n<=0) return 0;
else if (*a%2==0) return *a+f(a+1,n-1);
else return *a-f(a+1,n-1);
}
int main()
{
int a[]={12, 7, 13, 4, 11, 6};
printf(%d,f(a,6));
return 0;
}
(A) 9 (B) 5
(C) 15 (D) 19
Question. 48
The following C function takes a singly-linked list as input argument. It modified the list
by moving the last element to the front of the list and returns the modified list. Some part
of the code is left blank.
typedef struct node {
int value;
struct node *next
} Node;
Node mode
)
_to_front(Node *head){
2010 CS
CS 17/19
www.gatehelp.com
Node p, q;
)
)
if((head==NULL)<(head->next==NULL))return head;
q=NULL;p=head;
while(p->next!=NULL){
q=p;
p=q->next;
}
________________________
return head;
}
Choose the correct alternative to replace the blank line.
(A) q=NULL;p->next=head;head=p;
(B) q->next=NULL;head=p;p->next=head;
(C) head=p;p->next=q;q->next=NULL;
(D) q->next=NULL;p-next=head;head=p;
Question. 49
The following program is to be tested for statement coverage :
begin
if(a==b){S1;exit}
else if(c==d){S2;}
else {S3;exit;}
S4;
end
The test cases T1, T2, T3, and T4 given below are expressed in terms of the properties
satisfied by the values of variables a,b,c and d. The exact values are not given.
T1 : and a,b,c d are all equal
T2 : and a,b,c d are all distinct
T3 : and a b c! d = =
T4 : and a! b c d = =
2010 CS
CS 18/19
www.gatehelp.com
Which of the test suites given below ensures coverage of statements S1, S2, S3 and S4 ?
(A) T1, T2, T3 (B) T2, T4
(C) T3, T4 (D) T1, T2, T4
Statement for Linked Answer Questions 50 & 51
A has table of length 10 uses open addressing with hash function h(k)=k mod 10, and lin-
ear probing. After inserting 6 values into an empty has table, the table is as shown below.
0
1
2 42
3 23
4 34
5 52
6 46
7 33
8
9
Question. 50
Which one oft he following choices gives a possible order in which the key values could
have been inserted in the table ?
(A) 46, 42, 34, 52, 23, 33 (B) 34, 42, 23, 52, 33, 46
(C) 46, 34, 42, 23, 52, 33 (D) 42, 46, 33, 23, 34, 52
Question. 51
How many different insertion sequences of the key values using hte same hash function and
linear probing will result in the hash table shown above ?
(A) 10 (B) 20
(C) 30 (D) 40
2010 CS
CS 19/19
www.gatehelp.com
Question. 52
Let L1 be a recursive language. Let L2 and L3 be language that are recursively enumer-
able but not recursive. What of the following statements is not necessarily true ?
(A) L L 1 1 is recursively enumerable
(B) L L 1 3 is recursively enumerable
(C) L L 2 3 + is recursively enumerable
(D) 2 3 L L + is recursively enumerable
Question. 53
Let { (0 1) L ! = +
)
has even number of 1s}, i.e., L is the set of all bit strings with
even number of 1s. Which one of the regular expressions below represents L ?
(A) ( ) 0 10 1
) ) )
(B) ( ) 0 10 10
) ) ) )
(C) ( ) 0 10 1 0
) ) ) )
(D) ( ) 0 1 10 1 10
) ) ) )
Question. 54
Consider the language 1 { }, L i j 0 1
i j
= =Y 2 { }, L i j 0 1
i j
= = 3 { 2 1} L i j 0 1
i j
= = +
{ } L i j 4 0 1 2
i j
= =Y .Which one of the following statements is true ?
(A) Only L2 is context free (B) Only L2 and L3 are context free
(C) Only L1 and L2 are context free (D) All are context free
Question. 55
Let by any string of length n in{0, 1}
)
. Let L be the set of all substring so . What is
the minimum number of states in a non-deterministic finite automation that accepts L ?
(A) n 1 (B) n
(C) n 1 + (D) 2
n 1 +
**********