Time Left - 06:00 mins
BARC CS 2018 Nuclear Quiz -3 (DS)
Attempt now to get your rank among 741 students!
Question 1
Which of the following traversal is sufficient to construct Binary search tree from traversal?
I. Preorder
II. Inorder
III. Postorder
I. Preorder
II. Inorder
III. Postorder
Question 2
Trace the output
# include <stdio.h>
#define R 3
# define CO 4
Int Z[R][CO] = {1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12};
main()
{
int a, b, c=99;
for(a =0; a<R;++a)
for(b=0;b<CO;++b)
if(z[a][b] < c)
c = z[a][b];
printf(“%d”,c);
}
# include <stdio.h>
#define R 3
# define CO 4
Int Z[R][CO] = {1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12};
main()
{
int a, b, c=99;
for(a =0; a<R;++a)
for(b=0;b<CO;++b)
if(z[a][b] < c)
c = z[a][b];
printf(“%d”,c);
}
Question 3
A queue can be implemented using 2 stacks. Let stacks used are s1 and s2 and the queue be q.
Let operations enqueue and dequeue be:
enqueue(q, x):
a. push everything from s1 to s2 until s1 is empty
b. P
c. Q.
Dequeue(q):
a. pop item from s1.
The best possible option for P and Q are respectively
Let operations enqueue and dequeue be:
enqueue(q, x):
a. push everything from s1 to s2 until s1 is empty
b. P
c. Q.
Dequeue(q):
a. pop item from s1.
The best possible option for P and Q are respectively
Question 4
How many vertices a full 7-ary tree with 121 internal vertices have?
Question 5
What is the max size of the operand stack while evaluating the postfix exp 8 2 4 + - 2 7 1 / + * ?
- 741 attempts
- 5 upvotes
- 11 comments
Apr 6GATE & PSU CS