GATE 2007 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2007

184 questions

MCQ 1841-mark 184

Questions 91–95 of 184

Q91Sorting1 markMCQ−0.33 if wrong
Which of the following sorting algorithms has the lowest worst-case complexity?

Q92Asymptotic Notation1 markMCQ−0.33 if wrong
Exponentiation is a heavily used operation in public key cryptography. Which of the following options is the tightest upper bound on the number of multiplications required to compute bn mod m,0≤b,n≤mb^n \bmod{m}, 0 \leq b, n \leq m ?

Q93Asymptotic Notation1 markMCQ−0.33 if wrong
Consider the following C code segment:
 int IsPrime(n)
{
  int i,n;
  for(i=2;i<=sqrt(n);i++)
     if(n%i == 0)
      {printf("Not Primen"); return 0;}
  return 1;
} 
Let T(n)denote the number of times the for loop is executed by the program on input n. Which of the following is TRUE?

Q94Asymptotic Notation1 markMCQ−0.33 if wrong
What is the time complexity of the following recursive function:
 int DoSomething (int n) 
{
  if (n <= 2)
    return 1;
  else 
    return (DoSomething (floor(sqrt(n))) + n);
}

Q95Asymptotic Notation1 markMCQ−0.33 if wrong
In the following C function, let n≥\geqm.
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?