1
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
In the following C function, let n $$ \ge $$ m.
int gcd(n,m)
{
if (n % m == 0) return m;
n = n % m;
return gcd(m,n);
}
How many recursive calls are made by this function?
A
$$\Theta(\log_2n)$$
B
$$\Omega(n)$$
C
$$\Theta(\log_2\log_2n)$$
D
$$\Theta(\sqrt{n})$$
2
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:
A
$$\Theta(\log_2n)$$
B
$$\Theta(\log_2\log_2n)$$
C
$$\Theta(n)$$
D
$$\Theta(n\log_2n)$$
3
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons needed?
A
At least 2n – c comparisons, for some constant c, are needed.
B
At most 1.5n – 2 comparisons are needed.
C
At least n log2 n comparisons are needed.
D
None of the above.
4
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
Suppose the letters a, b, c, d, e, f have probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. Which of the following is the Huffman code for the letter a, b, c, d, e, f?
A
0, 10, 110, 1110, 11110, 11111
B
11, 10, 011, 010, 001, 000
C
11, 10, 01, 001, 0001, 0000
D
110, 100, 010, 000, 001, 111
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