Previous GATE Questions in Programming and DS

#141
16.7k
views
4 answers
62 votes
Consider a complete binary tree where the left and right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is...
#142
14.7k
views
4 answers
42 votes
Consider the following function written in the C programming langauge :void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } }The output of the above func...
#143
31.0k
views
12 answers
35 votes
A binary tree T has $20$ leaves. The number of nodes in T having two children is ______.
#144
1.6k
views
1 answers
3 votes
Consider the following program in pseudo-Pascal syntax. What is printed by the program if parameter $a$ in procedure $\text{test1}$ is passed ascall-by-reference paramete...
#145
6.4k
views
4 answers
24 votes
Insert the characters of the string $K \ R \ P \ C \ S \ N \ Y \ T \ J \ M$ into a hash table of size $10$.Use the hash function$$h(x)=( ord (x) – ord (\text{“}a\tex...
#146
23.3k
views
7 answers
55 votes
A binary search tree is used to locate the number $43$. Which of the following probe sequences are possible and which are not? Explain.$\begin{array}{llllll} \text{(a)} ...
#147
30.9k
views
5 answers
27 votes
A binary search tree is generated by inserting in order the following integers:$$50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24$$The number of nodes in the left subtree and ...
#148
14.4k
views
3 answers
28 votes
The minimum number of interchanges needed to convert the array into a max-heap is$89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70$$0$$1$$2$$3$
#149
4.5k
views
3 answers
21 votes
Which of the following sequences denotes the post order traversal sequence of the below tree?$f\; e\; g\; c\; d\; b\; a$$g\; c\; b\; d\; a\; f\; e$$g\; c\; d\; b\; f\; e\...
#150
12.5k
views
3 answers
29 votes
In the balanced binary tree in the below figure, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?$1$$3$$7$$8$
#151
14.0k
views
6 answers
39 votes
An advantage of chained hash table (external hashing) over the open addressing scheme isWorst case complexity of search operations is lessSpace used is lessDeletion is ea...
#152
15.3k
views
4 answers
33 votes
Consider the following statements:First-in-first out types of computations are efficiently supported by STACKS.Implementing LISTS on linked lists is more efficient than i...
#153
3.8k
views
3 answers
25 votes
What is the number of binary trees with $3$ nodes which when traversed in post-order give the sequence $A, B, C ?$ Draw all these binary trees.
#154
5.5k
views
3 answers
21 votes
Consider the following high level programming segment. Give the contents of the memory locations for variables $W, X, Y$ and $Z$ after the execution of the program segmen...
#155
11.6k
views
3 answers
26 votes
Which of the following statements is true?As the number of entries in a hash table increases, the number of collisions increases.Recursive programs are efficientThe worst...
#156
38.6k
views
7 answers
49 votes
The postfix expression for the infix expression $A+B*(C+D)/F+D*E$ is:$AB + CD + *F/D +E*$$ABCD + *F/DE* ++$$A * B + CD/F *DE ++$$A + *BCD/F* DE ++$
#157
36.4k
views
6 answers
43 votes
A binary tree $T$ has $n$ leaf nodes. The number of nodes of degree $2$ in $T$ is$\log_2 n$$n-1$$n$$2^n$
#158
7.6k
views
3 answers
32 votes
A queue $Q$ containing $n$ items and an empty stack $S$ are given. It is required to transfer all the items from the queue to the stack, so that the item at the front of ...
#159
5.1k
views
6 answers
29 votes
An array $A$ contains $n$ integers in non-decreasing order, $A \leq A \leq \cdots \leq A[n]$. Describe, using Pascal like pseudo code, a linear time algorithm to find $...
#160
1.9k
views
1 answers
1 votes
Consider the program below:Program main: var r:integer; procedure two: begin write (r); end procedure one: var r:integer; begin r:=5; two; end begin r:=2; two; one; two; ...