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

GATE 2009

66 questions

MCQ 661-mark 24 · 2-mark 42

Questions 26–30 of 66

Q26Pipeline Processor2 marksMCQ−0.67 if wrong
Consider a 4 stage pipeline processor. The number of cycles needed by the four instructions I1, I2, I3, I4 in stages S1, S2, S3, S4 is shown below:
S1 S2 S3 S4 I1 2 1 1 1 I2 1 3 2 2 I3 2 1 1 3 I4 1 2 2 2
What is the number of cycles needed to execute the following loop?
For (i=1 to 2) {I1; I2; I3; I4;}

Q27Function1 markMCQ−0.33 if wrong
Consider the program below:
 #include <stdio.h>
int fun(int n, int * f_p) {
   int t, f;
   if (n <=1) {
         *f_p =1;
          return 1;
   }
   t = fun (n-1, f_p);
   f = t+*f_p;
   *f_p = t;
   return f;
}
int main() {
    int x = 15;
    printf ("%d\n", fun(5,& x));
    return 0;
} 
The value printed is

Q28AVL Tree2 marksMCQ−0.67 if wrong
What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.

Q29Heap Tree2 marksMCQ−0.67 if wrong
Consider a binary max-heap implemented using an array.

What is the content of the array after two delete operations on {25,14,16,13,10,8,12}

Q30Heap Tree2 marksMCQ−0.67 if wrong
Consider a binary max-heap implemented using an array.

Which one of the following array represents a binary max-heap?