GATE 2015 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2015 (Session 2)

64 questions

MCQ 42 · NAT 221-mark 29 · 2-mark 35

Questions 21–25 of 64

Q21Function1 markMCQ−0.33 if wrong
Consider the following function written in the C programming language.
   void foo(char *a){
     if ( *a && *a != ' '){
          foo(a+1);
          putchar(*a);
       }
} 
The output of the above function on input "ABCD    EFGH""ABCD \; \; EFGH" is

Q22Heap Tree1 markMCQ−0.33 if wrong
Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is

Q23Binary Tree1 markNAT
A binary tree T has 20 leaves. The number of nodes in T having two children is _______.

Q24Function1 markNAT
Consider the following C function.
int fun(int n){
   int x=1,k;
   if (n==1) return x;
   for (k=1; k < n; ++k)
       x = x + fun(k) * fun(n-k);
   return x;
}
The return value of fun(5) is ________.

Q25Software Engineering1 markMCQ−0.33 if wrong
A software requirements specification (SRS) document should avoid discussing which one of the following?