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

GATE 2016 (Session 2)

65 questions

MCQ 38 · NAT 271-mark 30 · 2-mark 35

Questions 46–50 of 65

Q46Binary Tree2 marksMCQ−0.67 if wrong
Consider the following New-order strategy for traversing a binary tree:
Visit the root;
Visit the right sub tree using New-order;
Visit the left sub tree using New-order;
The New-order traversal of the expression tree corresponding to the reverse polish expression
3 4 * 5 - 2 ^ 6 7 * 1 + - is given by:

Q47Function2 marksNAT
Consider thefollowingprogram:

int f(int*p, int n)
{
   if (n<=1)return 0;
    else return max(f(p+1,n-1),p[0]-p[1]);
}
int main()
{
    int a[]={3,5,2,6,4};
    printf("%d", f(a,5));
 }
Note: max(x,y) returns the maxi mumof x and y. The value printed by this program is____________ .

Q48Dynamic Programming2 marksNAT
Let A1,A2,A3, and A4 be four matrices of dimensions 10x5, 5x20, 20x10, and 10x5, respectively. The minimum number of scalar multiplications required to find the product A1A2A3A4 using the basic matrix multiplication method is __________.

Q49Asymptotic Notation2 marksNAT
The given diagram shows the flowchart for a recursive function A(n). Assume that all statements, except for the recursive calls, have O(1) time complexity. If the worst case time complexity of this function is O(nα)O(n^{\alpha }), then the least possible value (accurate upto two decimal positions) of α\alpha is .
Start A(n/2) A(n/2) Return A(n/2) A(n/2) Return A(n/2) Return A(n/2) Return

Q50Binary Search Tree2 marksNAT
The number of ways in which the numbers 1,2,3,4,5,6,7 can be inserted in an empty binary search tree, such that the resulting tree has height 6, is _____.
Note: The height of a tree with a single node is 0.