The Gateway to Computer Science Excellence
For all GATE CSE Questions
Toggle navigation
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 and 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
(
41k
points)

11.4k
views
gate20162
datastructure
binarysearchtree
normal
numericalanswers
+14
votes
11
answers
2
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
(
1.6k
points)

2.4k
views
gate20172
programminginc
programming
+25
votes
11
answers
3
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
(
16.3k
points)

5.5k
views
gate2007it
datastructure
hashing
probability
normal
+38
votes
11
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$ ... 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
(
52.1k
points)

5.8k
views
gate1994
datastructure
arrays
normal
+25
votes
10
answers
5
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
(
414k
points)

4.9k
views
gate20171
programming
normal
tricky
recursion
+24
votes
10
answers
6
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.1k
points)

4.6k
views
gate20161
programminginc
recursion
normal
+17
votes
10
answers
7
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
(
97.7k
points)

4.2k
views
gate20152
datastructure
binarytree
normal
numericalanswers
+18
votes
9
answers
8
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
(
414k
points)

3.7k
views
gate20171
datastructure
binarysearchtree
easy
+62
votes
9
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$. ... 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.1k
points)

8.4k
views
gate20161
datastructure
queues
difficult
numericalanswers
+20
votes
9
answers
10
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
(
414k
points)

3k
views
gate1998
stack
infixpostfix
+31
votes
9
answers
11
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
(
16.3k
points)

4.4k
views
gate2004it
datastructure
linkedlists
normal
ambiguous
+26
votes
9
answers
12
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
(
97.7k
points)

3.2k
views
gate2010
datastructure
binarytree
normal
+29
votes
8
answers
13
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
(
1.6k
points)

7.9k
views
gate20172
programminginc
numericalanswers
+18
votes
8
answers
14
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
(
1.6k
points)

7.6k
views
gate20172
datastructure
queues
+38
votes
8
answers
15
GATE201053
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: mod \: 10$, and linear probing. After inserting $6$ ... 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
(
97.7k
points)

5.9k
views
datastructure
hashing
normal
gate2010
+25
votes
8
answers
16
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
(
97.7k
points)

3.9k
views
gate20153
datastructure
binarytree
normal
numericalanswers
+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
(
97.7k
points)

6.2k
views
gate2011
binarytree
normal
+28
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
(
97.7k
points)

3.4k
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
(
97.7k
points)

8.7k
views
gate20143
datastructure
binarysearchtree
numericalanswers
normal
+28
votes
8
answers
20
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
(
97.7k
points)

5.6k
views
gate20142
datastructure
stack
easy
+43
votes
8
answers
21
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
(
97.7k
points)

5.4k
views
gate20141
datastructure
binarytree
numericalanswers
normal
+47
votes
7
answers
22
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
(
6.8k
points)

7.5k
views
gate20171
datastructure
linkedlists
normal
+15
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
(
1.6k
points)

2.7k
views
gate20172
programminginc
numericalanswers
+7
votes
7
answers
24
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
(
69
points)

2.7k
views
programminginc
macros
isro2014
+7
votes
7
answers
25
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
(
47
points)

3.1k
views
isro2011
datastructure
trees
+31
votes
7
answers
26
GATE2016138
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$ ... possible integer value of $x$, for which at least one shortest path between some pair of vertices will contain the edge with weight $x$ is ___________.
asked
Feb 12, 2016
in
DS
by
Sandeep Singh
Loyal
(
7.1k
points)

7.3k
views
gate20161
datastructure
graphs
normal
numericalanswers
+26
votes
7
answers
27
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
(
41k
points)

3k
views
gate20162
programming
loopinvariants
normal
+16
votes
7
answers
28
TIFR2012B15
Let $T$ be a tree of $n$ nodes. Consider the following algorithm, that constructs a sequence of leaves $u_{1}, u_{2}...$. Let $u_{1}$ be some leaf of tree. Let $u_{2}$be a leaf that is farthest from $u_{1}$. Let $u_{3}$ be the leaf ... stays constant. For the same tree, the distance between the last two vertices visited can be different, based on the choice of the first leaf $u_{1}$.
asked
Nov 2, 2015
in
DS
by
makhdoom ghaya
Boss
(
29.5k
points)

889
views
tifr2012
datastructure
trees
+42
votes
7
answers
29
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
(
16.3k
points)

5.8k
views
gate2006it
programming
programminginc
normal
+30
votes
7
answers
30
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
(
16.3k
points)

4.6k
views
gate2006it
datastructure
binarytree
normal
Page:
1
2
3
4
5
6
...
164
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
IIT HYDERABAD MTECH TA INTERVIEW EXPERIENCE
How to prepare for GATE with a fulltime job??
Interview Experience at IISc
All subject Gate notes from Standard Books!!
My journey from Wipro to an IISc student  GATE 2019
All categories
General Aptitude
1.8k
Engineering Mathematics
7.3k
Digital Logic
2.9k
Programming and DS
4.9k
Programming
3.6k
DS
1.3k
Algorithms
4.4k
Theory of Computation
6.1k
Compiler Design
2.1k
Operating System
4.2k
Databases
4.1k
CO and Architecture
3.4k
Computer Networks
4.1k
Non GATE
1.4k
Others
1.5k
Admissions
595
Exam Queries
577
Tier 1 Placement Questions
23
Job Queries
72
Projects
18
Follow @csegate
Recent Blog Comments
@Anmol 300 books will be dispatched this month...
Dear Respected Sir, If I prebook now i.e.22...
Can you check your Spam too? Address confirmation...
yeah me too. I did not get the address...
49,811
questions
54,533
answers
188,417
comments
75,580
users