# CS GATE 2010 (Test 3)

Tag: cs gate 2010
Q.1
Choose the most appropriate word from the options given below to complete the following sentence: If we manage to ____________ our natural resources, we would leave a better planet for our children.
A. uphold
B. restrain
C. cherish
D. conserve
Explaination / Solution:
No Explaination.

Workspace
Report
Topic: Arithmetic Tag: CS GATE 2010
Q.2
Hari (H), Gita (G), Irfan (I) and Saira (S) are siblings (i.e. brothers and sisters). All were born on 1st january. The age difference between any two successive siblings (that is born one after another) is less than 3 years. Given the following facts:
i. Hari’s age + Gita’s age > Irfan’s age + Saira’s age
ii. The age difference between Gita and Saira is 1 year. However Gita is not the oldest and Saira is not the youngest.
iii. There are no twins.
In what order were they born (oldest first)?
A. HSIG
B. SGHI
C. IGSH
D. IHSG
Explaination / Solution:
No Explaination.

Workspace
Report
Q.3
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
Explaination / Solution:
No Explaination.

Workspace
Report
Q.4
Consider a network with 6 routers R1 to R6 connected with links having weights as shown in the following diagram 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
Explaination / Solution:
No Explaination.

Workspace
Report
Topic: Databases Tag: CS GATE 2010
Q.5
A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below Which one of the 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
Explaination / Solution:
No Explaination.

Workspace
Report
Q.6
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 = 5 + e
return d + f
Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute thi s program without spilling?
A. 2
B. 3
C. 4
D. 6
Explaination / Solution:
No Explaination.

Workspace
Report
Q.7
Let L1 be a recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is not necessarily true?
A. L2 – L1 is recursively enumerable
B. L1 – L3 is recursively enumerable
C. L2 ∩ L1 is recursively enumerable
D. L2 ∪ L1 is recursively enumerable
Explaination / Solution:
No Explaination.

Workspace
Report
Topic: Algorithms Tag: CS GATE 2010
Q.8
What does the following program print?
#include <stdio.h>
void f (int * p, int * g) {
p = q;
* p = 2;
}
int i = 0, j = 1;
int main ( ){
f(&i, & j);
print f ("%d %d \ n", i, j);
return 0;
}
A. 2 2
B. 2 1
C. 0 1
D. 0 2
Explaination / Solution:
No Explaination.

Workspace
Report
Q.9
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 structures
D. Those that use global variables
Explaination / Solution:
No Explaination.

Workspace
Report
Q.10
The following C function takes a simply-linked list as input argument. It modifies 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 *p, *q;
q = NULL; p = head;
while (p-> next !=NULL) {
q=P;
p=p->next;
}
_______________________________