The Gateway to Computer Science Excellence
For all GATE CSE Questions
Toggle navigation
GATE Overflow
Facebook Login
or
Email or Username
Password
Remember
Login
Register

I forgot my password
Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Prev
Blogs
New Blog
Exams
First time here? Checkout the
FAQ
!
x
×
Close
Use the google search bar on side panel. It searches through all previous GATE/other questions. For hardcopy of previous year questions please see
here
Most answered questions in Programming & DS
Recent
Hot!
Most votes
Most answers
Most views
Featured
Previous GATE
Webpage
Programming in C.
Recursion.
Recent
Hot!
Most votes
Most answers
Most views
Featured
Previous GATE
+76
votes
13
answers
1
GATE2016240
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$.
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
43.5k
points)

10.5k
views
gate20162
datastructure
binarysearchtree
normal
numericalanswers
+23
votes
10
answers
2
GATE2017135
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); fun1(++n); printf("%d", n); } The output printed when $\text{fun1}(5)$ is called is $53423122233445$ $53423120112233$ $53423122132435$ $53423120213243$
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
384k
points)

4.5k
views
gate20171
programming
normal
tricky
recursion
+23
votes
10
answers
3
GATE2016135
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 (n1); 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$
asked
Feb 12, 2016
in
Programming
by
Sandeep Singh
Loyal
(
7.9k
points)

4.3k
views
gate20161
programminginc
recursion
normal
+25
votes
10
answers
4
GATE2007IT28
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$
asked
Oct 30, 2014
in
DS
by
Ishrat Jahan
Boss
(
19.1k
points)

4.8k
views
gate2007it
datastructure
hashing
probability
normal
+38
votes
10
answers
5
GATE19941.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$ ... new representation is: $i+j$ $i+j1$ $(j1)+\frac{i(i1)}{2}$ $i+\frac{j(j1)}{2}$
asked
Oct 4, 2014
in
DS
by
Kathleen
Veteran
(
59.9k
points)

5.3k
views
gate1994
datastructure
arrays
normal
+18
votes
9
answers
6
GATE201716
Let $T$ be a binary search tree with $15$ nodes. The minimum and maximum possible heights of $T$ are: Note: The height of a tree with a single node is $0$. $4$ and $15$ respectively. $3$ and $14$ respectively. $4$ and $14$ respectively. $3$ and $15$ respectively.
asked
Feb 14, 2017
in
DS
by
Arjun
Veteran
(
384k
points)

3.5k
views
gate20171
datastructure
binarysearchtree
easy
+14
votes
9
answers
7
GATE2017214
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$
asked
Feb 14, 2017
in
Programming
by
Madhav
Active
(
2k
points)

2.3k
views
gate20172
programminginc
+62
votes
9
answers
8
GATE2016141
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 it from $S$. ... else x:= Pop(S); Enqueue (Q, x); end end The maximum possible number of iterations of the while loop in the algorithm is _______.
asked
Feb 12, 2016
in
DS
by
Sandeep Singh
Loyal
(
7.9k
points)

7.9k
views
gate20161
datastructure
queues
difficult
numericalanswers
+26
votes
9
answers
9
GATE201010
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{(n1)}{2}$ $n1$
asked
Sep 29, 2014
in
DS
by
jothee
Veteran
(
115k
points)

3k
views
gate2010
datastructure
binarytree
normal
+28
votes
8
answers
10
GATE2017255
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 _______
asked
Feb 14, 2017
in
Programming
by
Madhav
Active
(
2k
points)

7.5k
views
gate20172
programminginc
numericalanswers
+7
votes
8
answers
11
ISRO201119
If node A has three siblings and B is parent of A, what is the degree of A? 0 3 4 5
asked
Jun 15, 2016
in
DS
by
shibu
(
53
points)

3.1k
views
isro2011
datastructure
trees
+37
votes
8
answers
12
GATE201053
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: mod \: 10$, and linear probing. After inserting $6$ values into an empty hash table, the table is shown as below $0$ $1$ $2$ $42$ $3$ $23$ $4$ $34$ $5$ ... insertion sequences of the key values using the same hash function and linear probing will result in the hash table shown above? $10$ $20$ $30$ $40$
asked
Apr 21, 2016
in
DS
by
jothee
Veteran
(
115k
points)

5.5k
views
datastructure
hashing
difficult
gate2010
+20
votes
8
answers
13
GATE199819b
Compute the post fix equivalent of the following expression $3^*\log(x+1)\frac{a}{2}$
asked
Aug 29, 2015
in
DS
by
Arjun
Veteran
(
384k
points)

2.8k
views
gate1998
stack
infixpostfix
+25
votes
8
answers
14
GATE2015325
Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______.
asked
Feb 14, 2015
in
DS
by
jothee
Veteran
(
115k
points)

3.7k
views
gate20153
datastructure
binarytree
normal
numericalanswers
+17
votes
8
answers
15
GATE2015210
A binary tree T has $20$ leaves. The number of nodes in T having two children is ______.
asked
Feb 12, 2015
in
DS
by
jothee
Veteran
(
115k
points)

3.8k
views
gate20152
datastructure
binarytree
normal
numericalanswers
+31
votes
8
answers
16
GATE2004IT13
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worstcase time complexity of the bestknown algorithm to delete the node $x$ from the list ? $O(n)$ $O(\log^2 n)$ $O(\log n)$ $O(1)$
asked
Nov 2, 2014
in
DS
by
Ishrat Jahan
Boss
(
19.1k
points)

4k
views
gate2004it
datastructure
linkedlists
normal
ambiguous
+28
votes
8
answers
17
GATE201129
We are given a set of $n$ distinct elements and an unlabeled binary tree with $n$ nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree? $0$ $1$ $n!$ $\frac{1} {n+1} .^{2n}C_n$
asked
Sep 29, 2014
in
DS
by
jothee
Veteran
(
115k
points)

5.7k
views
gate2011
binarytree
normal
+25
votes
8
answers
18
GATE2014342
Consider the C function given below. Assume that the array $listA$ contains $n (>0)$ elements, sorted in ascending order. int ProcessArray(int *listA, int x, int n) { int i, j, k; i = 0; j = n1; do { k = (i+j)/2; if (x <= listA[ ... is an implementation of binary search. It will always find the maximum element in $listA$. It will return −$1$ even when $x$ is present in $listA$.
asked
Sep 28, 2014
in
DS
by
jothee
Veteran
(
115k
points)

3.2k
views
gate20143
datastructure
arrays
easy
+58
votes
8
answers
19
GATE2014339
Suppose we have a balanced binary search tree $T$ holding $n$ numbers. We are given two numbers $L$ and $H$ and wish to sum up all the numbers in $T$ that lie between $L$ and $H$. Suppose there are $m$ such numbers in $T$. If the tightest upper bound on the time to compute the sum is $O(n^a\log^bn+m^c\log^dn)$, the value of $a+10b+100c+1000d$ is ______.
asked
Sep 28, 2014
in
DS
by
jothee
Veteran
(
115k
points)

8.1k
views
gate20143
datastructure
binarysearchtree
numericalanswers
normal
+41
votes
8
answers
20
GATE2014112
Consider a rooted n node binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having exactly $4$ nodes is $O(n^a\log^bn)$. Then the value of $a+10b$ is __________.
asked
Sep 26, 2014
in
DS
by
jothee
Veteran
(
115k
points)

5.1k
views
gate20141
datastructure
binarytree
numericalanswers
normal
+47
votes
7
answers
21
GATE2017108
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 point to valid NULL ... or 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.
asked
Feb 14, 2017
in
DS
by
khushtak
Loyal
(
7.9k
points)

7.2k
views
gate20171
datastructure
linkedlists
normal
+21
votes
7
answers
22
GATE2017120
Let $T$ be a tree with $10$ vertices. The sum of the degrees of all the vertices in $T$ is ________
asked
Feb 14, 2017
in
DS
by
Arjun
Veteran
(
384k
points)

3.8k
views
gate20171
datastructure
trees
numericalanswers
+14
votes
7
answers
23
GATE2017254
Consider the following C program. #include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n; n1; n=n1; printf(“%d”, n); return 0; } The output of the program is ______
asked
Feb 14, 2017
in
Programming
by
Madhav
Active
(
2k
points)

2.5k
views
gate20172
programminginc
numericalanswers
+17
votes
7
answers
24
GATE2017213
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. Which of ... node points to the front node. (I) only. (II) only. Both (I) and (II). Neither (I) nor (II).
asked
Feb 14, 2017
in
DS
by
Madhav
Active
(
2k
points)

7.1k
views
gate20172
datastructure
queues
+7
votes
7
answers
25
ISRO20143
What is the output of the following C program? #include<stdio.h> #define SQR(x) (x*x) int main() { int a; int b=4; a=SQR(b+2); printf("%d\n",a); return 0; } 14 36 18 20
asked
Jun 22, 2016
in
Programming
by
pooja14
(
89
points)

2.6k
views
programminginc
macros
isro2014
+25
votes
7
answers
26
GATE2016235
The following function computes $X^{Y}$ for positive integers $X$ and $Y$. int exp (int X, int Y) { int res =1, a = X, b = Y; while (b != 0) { if (b % 2 == 0) {a = a * a; b = b/2; } else {res = res * a; b = b  1; } } return res; } Which one of the following conditions is TRUE ... loop? $X^{Y} = a^{b}$ $(res * a)^{Y} = (res * X)^{b}$ $X^{Y} = res * a^{b}$ $X^{Y} = (res * a)^{b}$
asked
Feb 12, 2016
in
Programming
by
Akash Kanase
Boss
(
43.5k
points)

2.8k
views
gate20162
programming
loopinvariants
normal
+40
votes
7
answers
27
GATE2006IT49
Which one of the choices given below would be printed when the following program is executed ? #include <stdio.h> struct test { int i; char *c; }st[] = {5, "become", 4, "better", 6, "jungle", 8, "ancestor", 7, "brother"}; ... $\text{etter, u, 6, ungle}$ $\text{cetter, k, 6, jungle}$ $\text{etter, u, 8, ncestor}$
asked
Nov 1, 2014
in
Programming
by
Ishrat Jahan
Boss
(
19.1k
points)

5.4k
views
gate2006it
programming
programminginc
normal
+30
votes
7
answers
28
GATE2006IT9
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$
asked
Oct 31, 2014
in
DS
by
Ishrat Jahan
Boss
(
19.1k
points)

4.2k
views
gate2006it
datastructure
binarytree
normal
+28
votes
7
answers
29
GATE2014241
Suppose a stack implementation supports an instruction $REVERSE$, which reverses the order of elements on the stack, in addition to the $PUSH$ and $POP$ instructions. Which one of the following statements is TRUE (with respect to this modified stack)? A ... $ENQUEUE$ and $DEQUEUE$ take a single instruction each.
asked
Sep 28, 2014
in
DS
by
jothee
Veteran
(
115k
points)

5.3k
views
gate20142
datastructure
stack
easy
+19
votes
7
answers
30
GATE19982.11
A complete $n$ary tree is one in which every node has $0$ or $n$ sons. If $x$ is the number of internal nodes of a complete $n$ary tree, the number of leaves in it is given by $x(n1) +1$ $xn1$ $xn +1$ $x(n+1)$
asked
Sep 26, 2014
in
DS
by
Kathleen
Veteran
(
59.9k
points)

2.3k
views
gate1998
datastructure
trees
normal
Page:
1
2
3
4
5
6
...
163
next »
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
Official keys are out now.
JEST 2019 MEMORY BASED QUESTION PAPER
Relax... But....
Barc : Arjun Sir
JEST Sample Question
All categories
General Aptitude
1.5k
Engineering Mathematics
7.1k
Digital Logic
2.7k
Programming & DS
4.9k
Programming
3.6k
DS
1.3k
Algorithms
4.2k
Theory of Computation
5.3k
Compiler Design
2.1k
Operating System
4k
Databases
4k
CO & Architecture
3.5k
Computer Networks
4k
Non GATE
1.4k
Others
1.5k
Admissions
559
Exam Queries
553
Tier 1 Placement Questions
23
Job Queries
69
Projects
18
Follow @csegate
Recent Blog Comments
Agreed. And i see some people who have even...
@
As far as I read from various sources, GOAPS will...
ask the same question of the jest exam on GO and...
@Arjun sir please help us for which question we...
47,910
questions
52,287
answers
182,227
comments
67,728
users