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

I forgot my password
All Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous
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
+72
votes
12
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
(
43k
points)

8.7k
views
gate20162
datastructure
binarysearchtree
normal
numericalanswers
+21
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
(
363k
points)

3.7k
views
gate20171
programming
normal
tricky
recursion
+21
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.8k
points)

3.8k
views
gate20161
programminginc
recursion
normal
+34
votes
10
answers
4
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$, nonzero elements, (i.e elements of lower triangle) of each row are stored one after another, starting from the first row, the index of the ... 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.6k
points)

4.6k
views
gate1994
datastructure
arrays
normal
+18
votes
9
answers
5
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
(
363k
points)

3.1k
views
gate20171
datastructure
binarysearchtree
easy
+14
votes
9
answers
6
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)

2k
views
gate20172
programminginc
+23
votes
9
answers
7
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
(
105k
points)

2.5k
views
gate2010
datastructure
binarytree
normal
+25
votes
8
answers
8
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)

6.1k
views
gate20172
programminginc
numericalanswers
+58
votes
8
answers
9
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$. Consider ... 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.8k
points)

6.6k
views
gate20161
datastructure
queues
difficult
numericalanswers
+23
votes
8
answers
10
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$. It 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
(
105k
points)

2.7k
views
gate20143
datastructure
arrays
easy
+51
votes
8
answers
11
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
(
105k
points)

6.7k
views
gate20143
datastructure
binarysearchtree
numericalanswers
normal
+41
votes
8
answers
12
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
(
105k
points)

4.2k
views
gate20141
datastructure
binarytree
numericalanswers
normal
+45
votes
7
answers
13
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.7k
points)

6.1k
views
gate20171
datastructure
linkedlists
normal
+12
votes
7
answers
14
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.2k
views
gate20172
programminginc
numericalanswers
+17
votes
7
answers
15
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)

6.3k
views
gate20172
datastructure
queues
+7
votes
7
answers
16
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
+7
votes
7
answers
17
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)

3k
views
isro2011
datastructure
trees
+25
votes
7
answers
18
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
(
43k
points)

2.4k
views
gate20162
programming
loopinvariants
normal
+19
votes
7
answers
19
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
(
363k
points)

2.3k
views
gate1998
stack
infixpostfix
+24
votes
7
answers
20
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
(
105k
points)

3.2k
views
gate20153
datastructure
binarytree
normal
numericalanswers
+17
votes
7
answers
21
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
(
105k
points)

3.3k
views
gate20152
datastructure
binarytree
normal
numericalanswers
+29
votes
7
answers
22
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)

3.5k
views
gate2004it
datastructure
linkedlists
normal
ambiguous
+38
votes
7
answers
23
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"}; ... 8, nclastor}$ $\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)

4.2k
views
gate2006it
programming
programminginc
normal
+22
votes
7
answers
24
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.2k
views
gate2007it
datastructure
hashing
probability
normal
+28
votes
7
answers
25
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
(
105k
points)

4.8k
views
gate2011
binarytree
normal
+18
votes
7
answers
26
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.6k
points)

2.1k
views
gate1998
datastructure
trees
normal
+21
votes
7
answers
27
GATE201350
The procedure given below is required to find and replace certain characters inside an input character string supplied in array $A$. The characters to be replaced are supplied in array $oldc$, while their respective replacement characters are supplied in array $newc$. Array $A$ ... given above, how many test cases will be able to capture the flaw? Only one Only two Only three All four
asked
Sep 24, 2014
in
DS
by
Arjun
Veteran
(
363k
points)

2.1k
views
gate2013
datastructure
arrays
normal
+14
votes
7
answers
28
GATE20044, ISRO200926
The following numbers are inserted into an empty binary search tree in the given order: $10, 1, 3, 5, 15, 12, 16$. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)? $2$ $3$ $4$ $6$
asked
Sep 19, 2014
in
DS
by
Kathleen
Veteran
(
59.6k
points)

3.3k
views
gate2004
datastructure
binarysearchtree
easy
isro2009
+36
votes
7
answers
29
GATE200364
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 stack ... $m$ from S. The average stacklife of an element of this stack is $n(X+Y)$ $3Y+2X$ $n(X+Y)X$ $Y+2X$
asked
Sep 17, 2014
in
DS
by
Kathleen
Veteran
(
59.6k
points)

5k
views
gate2003
datastructure
stack
normal
+6
votes
6
answers
30
GATE201821
Consider the following $\text{C}$ program: #include<stdio.h> int counter=0; int calc (int a, int b) { int c; counter++; if(b==3) return (a*a*a); else { c = calc(a, b/3); return (c*c*c); } } int main() { calc(4, 81); printf("%d", counter); } The output of this program is ______.
asked
Feb 14
in
Programming
by
gatecse
Boss
(
18.3k
points)

1.9k
views
gate2018
programminginc
numericalanswers
recursion
Page:
1
2
3
4
5
6
...
148
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
Members at the site
amit1
harsh1996
Lakshman Patel RJIT
register_user_19
19gate
Sas
kumar.dilip
Recent Posts
Basic LaTeX guide
IIT Madras Phd
Databases GO Classroom
Happy Birthday Sir Arjun
NIELIT EXAM DATE 2018
All categories
General Aptitude
1.4k
Engineering Mathematics
6.3k
Digital Logic
2.4k
Programming & DS
4.4k
Programming
3.2k
DS
1.2k
Algorithms
3.8k
Theory of Computation
4.8k
Compiler Design
1.8k
Operating System
3.5k
Databases
3.5k
CO & Architecture
3k
Computer Networks
3.5k
Non GATE
1.2k
Others
1.3k
Admissions
508
Exam Queries
491
Tier 1 Placement Questions
23
Job Queries
64
Projects
17
Follow @csegate
Gatecse
Recent Blog Comments
Sir for final year student who have exam in...
I guess you meant while chasing :) Anyway those...
I'll write a post on how to best...
@Gaurav Go through all the previous yr questions,...
42,572
questions
48,562
answers
155,427
comments
63,581
users