Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Most answered questions in Programming and DS
168
votes
17
answers
1
GATE CSE 2016 Set 2 | Question: 40
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$.
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 _________.No...
Akash Kanase
50.0k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
binary-search-tree
normal
numerical-answers
+
–
67
votes
14
answers
2
GATE CSE 2018 | Question: 46
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
gatecse
39.2k
views
gatecse
asked
Feb 14, 2018
DS
gatecse-2018
binary-heap
numerical-answers
combinatory
2-marks
+
–
70
votes
13
answers
3
GATE CSE 2017 Set 2 | Question: 55
Consider the following C program. #include<stdio.h> #include<string.h> int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; } The output of the program is _______
Consider the following C program.#include<stdio.h #include<string.h int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; }T...
Madhav
28.0k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
array
pointers
+
–
174
votes
13
answers
4
GATE IT 2007 | Question: 29
When searching for the key value $60$ in a binary search tree, nodes containing the key values $10, 20, 40, 50, 70, 80, 90$ are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search path from the root to the node containing the value $60$? $35$ $64$ $128$ $5040$
When searching for the key value $60$ in a binary search tree, nodes containing the key values $10, 20, 40, 50, 70, 80, 90$ are traversed, not necessarily in the order gi...
Ishrat Jahan
39.4k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2007
data-structures
binary-search-tree
normal
+
–
143
votes
12
answers
5
GATE CSE 2016 Set 1 | Question: 41
Let $Q$ denote a queue containing sixteen numbers and $S$ be an empty stack. $Head(Q)$ returns the element at the head of the queue $Q$ without removing it from $Q$. Similarly $Top(S)$ returns the element at the top of $S$ without removing ... = Pop(S); Enqueue (Q, x); end end The maximum possible number of iterations of the while loop in the algorithm is _______.
Let $Q$ denote a queue containing sixteen numbers and $S$ be an empty stack. $Head(Q)$ returns the element at the head of the queue $Q$ without removing it from $Q$. Simi...
Sandeep Singh
35.0k
views
Sandeep Singh
asked
Feb 12, 2016
DS
gatecse-2016-set1
data-structures
queue
difficult
numerical-answers
+
–
42
votes
12
answers
6
GATE CSE 2015 Set 3 | Question: 25
Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______.
Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______.
go_editor
24.4k
views
go_editor
asked
Feb 14, 2015
DS
gatecse-2015-set3
data-structures
binary-tree
normal
numerical-answers
+
–
35
votes
12
answers
7
GATE CSE 2015 Set 2 | Question: 10
A binary tree T has $20$ leaves. The number of nodes in T having two children is ______.
A binary tree T has $20$ leaves. The number of nodes in T having two children is ______.
go_editor
30.5k
views
go_editor
asked
Feb 12, 2015
DS
gatecse-2015-set2
data-structures
binary-tree
normal
numerical-answers
+
–
57
votes
12
answers
8
GATE CSE 2010 | Question: 10
In a binary tree with $n$ nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child? $0$ $1$ $\frac{(n-1)}{2}$ $n-1$
In a binary tree with $n$ nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree ...
go_editor
16.4k
views
go_editor
asked
Sep 29, 2014
DS
gatecse-2010
data-structures
binary-tree
normal
+
–
89
votes
12
answers
9
GATE CSE 2003 | Question: 64
Let S be a stack of size $n \geq1$. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform $n$ pop operations. Assume that Push and Pop operations take $X$ seconds each, and $Y$ seconds elapse between the end of one such ... S. The average stack-life of an element of this stack is $n(X+Y)$ $3Y+2X$ $n(X+Y)-X$ $Y+2X$
Let S be a stack of size $n \geq1$. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform $n$ pop operations. Assume th...
Kathleen
31.2k
views
Kathleen
asked
Sep 17, 2014
DS
gatecse-2003
data-structures
stack
normal
+
–
40
votes
11
answers
10
GATE CSE 2021 Set 2 | Question: 10
Consider the following $\text{ANSI C}$ program. #include <stdio.h> int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) { for (j=0; j<5; j++) { arr[i][j] = 10 * i + j; } } printf(“%d”, *(arr[1]+9)); return 0; } What is the output of the above program? $14$ $20$ $24$ $30$
Consider the following $\text{ANSI C}$ program.#include <stdio.h int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) { for (j=0; j<5; j++) { arr[i...
Arjun
30.3k
views
Arjun
asked
Feb 18, 2021
Programming in C
gatecse-2021-set2
programming-in-c
array
output
1-mark
+
–
85
votes
11
answers
11
GATE CSE 2017 Set 1 | Question: 08
Consider the C code fragment given below. typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p->next != NULL) { p = p->next; } p->next = m; } Assuming that m and n ... append list m to the end of list n. cause a null pointer dereference for all inputs. append list n to the end of list m for all inputs.
Consider the C code fragment given below.typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p->next != NULL) { p = p->ne...
khushtak
25.8k
views
khushtak
asked
Feb 14, 2017
DS
gatecse-2017-set1
data-structures
linked-list
normal
+
–
47
votes
11
answers
12
GATE CSE 2017 Set 1 | Question: 35
Consider the following two functions. void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("%d", n); ... printf("%d", n); } The output printed when $\text{fun1}(5)$ is called is $53423122233445$ $53423120112233$ $53423122132435$ $53423120213243$
Consider the following two functions.void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("...
Arjun
20.5k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
normal
tricky
recursion
+
–
35
votes
11
answers
13
GATE CSE 2017 Set 2 | Question: 13
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively ... to the front node. (I) only. (II) only. Both (I) and (II). Neither (I) nor (II).
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly t...
Madhav
27.7k
views
Madhav
asked
Feb 14, 2017
DS
gatecse-2017-set2
data-structures
queue
+
–
30
votes
11
answers
14
GATE CSE 2017 Set 2 | Question: 14
Consider the following function implemented in C: void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); } The output of invoking $printxy(1,1)$ is: $0, 0$ $0, 1$ $1, 0$ $1, 1$
Consider the following function implemented in C:void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); }The output of invoking $...
Madhav
9.7k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
identify-function
pointers
+
–
44
votes
11
answers
15
GATE CSE 2016 Set 1 | Question: 35
What will be the output of the following $C$ program? void count (int n) { static int d=1; printf ("%d",n); printf ("%d",d); d++; if (n>1) count (n-1); printf ("%d",d); } void main(){ count (3); } $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4 \ 4 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2 \ 2 \ 2$ $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2$
What will be the output of the following $C$ program?void count (int n) { static int d=1; printf ("%d",n); printf ("%d",d); d++; if (n>1) count (n-1); printf ("%d",d); } ...
Sandeep Singh
15.6k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
recursion
normal
+
–
62
votes
11
answers
16
GATE CSE 2015 Set 3 | Question: 26
Consider the following C program #include<stdio.h> int main() { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; printf("%d%d", ptr-p, **ptr); } The output of the program is _______.
Consider the following C program#include<stdio.h int main() { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int ptr = p; ptr++; print...
go_editor
22.7k
views
go_editor
asked
Feb 15, 2015
Programming in C
gatecse-2015-set3
programming
programming-in-c
normal
numerical-answers
pointers
+
–
57
votes
11
answers
17
GATE IT 2006 | Question: 9
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree is $10$ $11$ $12$ $15$
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree i...
Ishrat Jahan
26.2k
views
Ishrat Jahan
asked
Oct 31, 2014
DS
gateit-2006
data-structures
binary-tree
normal
+
–
41
votes
11
answers
18
GATE IT 2007 | Question: 30
Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are: $isEmpty (Q)$ - returns true if the queue is empty, false otherwise. $delete (Q)$ - deletes the element at the front of the queue ... the front of the queue $Q$ and inserts it at the rear keeping the other elements in the same order Empties the queue $Q$
Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:$isEmpty (Q)$ — returns true if the queue is empty...
Ishrat Jahan
16.3k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2007
data-structures
queue
normal
+
–
62
votes
11
answers
19
GATE IT 2007 | Question: 28
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collides with an existing one exceed $0.5$. $5$ $6$ $7$ $10$
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collide...
Ishrat Jahan
29.4k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2007
data-structures
hashing
probability
normal
+
–
75
votes
11
answers
20
GATE CSE 1994 | Question: 1.11
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, non-zero elements, (i.e elements of lower triangle) of each row are stored one after another, starting from the first row, the index of the ... is: $i+j$ $i+j-1$ $(j-1)+\frac{i(i-1)}{2}$ $i+\frac{j(j-1)}{2}$
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, non-zero eleme...
Kathleen
28.3k
views
Kathleen
asked
Oct 4, 2014
DS
gate1994
data-structures
array
normal
+
–
Page:
1
2
3
4
5
6
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register