GATE 2019 -National Champion Test : (Programming & DS) (App update required to attempt this test)
Attempt now to get your rank among 847 students!
Question 1
Question 2
30, 16, 18, 35, 50, 10, 20, 23, 15
Find the number of swaps done to convert the almost complete binary tree into max heap _________.
Question 3
Inorder: A, M, N, O, P, Q, R, S, T, X, Z
Preorder: Q, P, A, M, N, O, X, S, R, T, Z
Find the number of elements in the 4th, 5th and 6th level respectively. Assume root is at level 1.
Question 4
Post-order: 1, 3, 5, 4, 2, 6, 9, 11, 13, 12, 10, 8, 7
Inorder : 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
Find the number of nodes in the last level of binary search tree? (Assume root is at first level)
Question 5
Question 6
Consider the following program.
variable l;
procedure k1(var l)
begin
printf(-- l);
end
procedure K2(var m)
begin
K1(m);
End
Begin
l=6;
K2(l);
print(l);
l = l +2;
K1(l);
end
If static scoping is used, which of the following is correct output for the above program?
Question 7
int fun (int n)
ifreturn (n% 10);
else return fun
What is the return value of fun(9874)?
Question 8
Void F (int n)
{
if(n<=1)
Print(1);
else
{
F(n/2);
F(n/4);
}
}
Find how many times 1 is printed by the above code if F(16) is called ?
Question 9
• push (A):push the letter A from the alphabet on to the stack
• emit(): output the top letter form the stack.
• pop() pop the top letter from the stack.
Stack is initially empty and we do not perform pop() on empty stack. Assume only emit() can print output and stack may or may not be empty finally. What is the minimum number of stack operations to get “ A B C A C B A” as output.
Question 10
Question 11
void take (int n)
{
if(n<0)
return ;
take(n-1);
take(n-2);
take(n-3);
Printf("%d",n);
}
If take(6) function is being called in main() then how many times will the take() function be invoked before returning to the main() _____.
Question 12
The output of the program is ______.
- 847 attempts
- 1 upvote
- 14 comments