1
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6
Let A[1,...,n] be an array storing a bit (1 or 0) at each location, and f(m) is a function whose time complexity is O(m). Consider the following program fragment written in a C like language:
counter = 0;
for(i = 1; i <= n; i++){
 if(A[i]==1){
   counter++;
 }else{
   f(counter); counter = 0;
 }
}
The complexity of this program fragment is
A
$$\Omega ({n^2})$$
B
$$\Omega (n\,\log n)\,and\,O({n^2})$$
C
$$\theta (n)$$
D
$$O(n)$$
2
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6
What does the following algorithm approximate?
(Assume m > 1, $$ \in > 0$$)
x = m;
y = 1;
while(x - y > ε){
 x = (x + y) / 2;
 y = m/x;
}
print(x);
A
log m
B
m2
C
m1/2
D
m1/3
3
GATE CSE 2004
MCQ (Single Correct Answer)
+1
-0.3
The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of
A
$$n$$
B
$${n^2}$$
C
$$n\log n$$
D
$$n{\log ^2}n$$
4
GATE CSE 2004
MCQ (Single Correct Answer)
+1
-0.3
Consider the grammar rule $$E \to {E_1} - {E_2}$$ for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the register. If E1 and E2 do not have any common sub-expression, in order to get the shortest possible code.
A
E1 should be evaluated first
B
E2 should be evaluated first
C
Evaluation of E1 and E2 should necessarily be interleaved
D
Order to evaluation of E1 and E2 is of no consequence
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12