GATE CS 2019 : Prog & DS MiniMock Quiz -1
Attempt now to get your rank among 369 students!
Question 1
Question 2
I. Preorder
II. Inorder
III. Postorder
Question 3
main()
{
int i =_1_abc(10);
print f ("%d\n",--i);
}
int_1_abc(int i)
{
return(i ++);
}
Question 4
int x;
int main()
{
int y;
//
{
int z;
//
}
}
Which variable has the longest scope in the above program?
Question 5
Infix: (a+b)(p+q)(r*s*t)
Question 6
Question 7
Assume is power operator and it has the highest precedence and follows right associativity. What is the output of the following postfix expression evaluated using operand stack?
(Note : 23=8)
991*91+9-9+
Question 8
Question 9
PUSH (S, P, Q, Ti, x)
{
if (_______A_______)
{
printf(“stack overflow”);
exit (1);
}
else
Ti ++;
S[ Ti ] = x;
}
Stack 0 store element from 0 to Q – 1, stack 1 stores from q to 2Q -1, and similarly other stack will store elements. Which of the following is the correct expression to replace A in the function?
Question 10
Question 11
Struct node
{
int data;
struct node *;/*left pointer*/
struct node *;/*right pointer*/
};
Let us assume P be the node in the existing linked list. Which of the following is true about the following code C1?
Code C1 :
Assume memory is made free automatically by the compiler after deletion.
Question 12
A binary search tree was constructed by inserting following elements in to an initially empty binary tree.
50, 27, 16, 88, 34, 65, 77,52, 93, 4, 12, 29, 44, 92
Preorder and postorder traversals of the resultant binary search tree were stored in arrays A and B respectively. How many elements have same index location in both the arrays? [Assume arrays A and B start from the same index]
Question 13
void f(int n)
{
if (n 0) return;
else
{
print (n);
f(n-2);
print (n);
f(n-1);
}
}
Let R(n) be the recurence relation which computes the sum of values printed by the f(n). The R(n) is
Question 14
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 15
Consider the following code
int DO(char *gate)
{
char *gate1 = gate;
char *gate2 = gate + strlen (gate) – 1;
while (gate1 < =gate2)
{
if (*gate1 ++! = *gate2 --)
Return 0;
}
return 1;
}
What is the functionality of above function Do ()?
- 369 attempts
- 1 upvote
- 5 comments
Tags :
GATE & PSU CSGeneral