GATE Computer Science and IT Solved Paper 2015 Session 1 - Part 7

61.       Consider the following relations:
Consider the following SQL query.
SELECT S.Student_Name, sum(P.Marks)
FROM Student S, Performance P
WHERE S.Roll_No = P.Roll_No
GROUP BY S.Student_Name
The number of rows that will be returned by the SQL query is ..................
Answer: 2
62.       What is the output of the following C code? Assume that the address of x is 2000 (in decimal) and an integer requires four bytes of memory.
int main () {
unsigned int x[4][3] = {{1,2,3},{4,5,6},{7,8,9},{10,11,12}};
printf(“%u, %u, %u”, x+3, *(x+3), *(x+2)+3);
}
(A) 2036, 2036, 2036              (B) 2012, 4, 2204
(C) 2036, 10, 10                       (D) 2012, 4, 6
Answer: A

63.       The graph shown below has 8 edges with distinct integer edge weights. The minimum spanning tree (MST) is of weight 36 and contains the edges: {(A, C), (B, C), (B, E), (E, F), (D, F)}. The edge weights of only those edges which are in the MST are given in the figure shown below. The minimum possible sum of weights of all 8 edges of this graph is ...................
Answer: 69
64.       Consider the following C function.
int fun1(int n) {
int i,j,k,p,q=0;
for (i=1; i<n; ++i) {
p=0;
for (j=n; j>1; j=j/2)
++p;
for (k=1; k<p; k=k*2)
++q;
}
return q;
}
Which one of the following most closely approximates the return value of the function fun1?
(A) n3                             (B) n(log n)2
(C) n log n                     (D) n log(log n)
Answer: D
65.       Consider the following pseudo code, where x and y are positive integers.
begin
q := 0
r := x
while r ≥ y do
begin
r := r – y
q := q + 1
end
end
The post condition that needs to be satisfied after the program terminates is
(A) {r=qx+y ˄ r<y}                     (B) { x=qy+r ˄ r<y}
(C) {y=qx+r ˄ 0<r<y}                (D) {q+1<r-y ˄ y>0}
Answer: B


Post a Comment

0 Comments