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
Hot 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
GATE2016-2-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$.
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
43.5k
points)
|
10.5k
views
gate2016-2
data-structure
binary-search-tree
normal
numerical-answers
+62
votes
9
answers
2
GATE2016-1-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 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
gate2016-1
data-structure
queues
difficult
numerical-answers
+77
votes
5
answers
3
GATE2007-IT-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$
asked
Oct 30, 2014
in
DS
by
Ishrat Jahan
Boss
(
19.1k
points)
|
9.4k
views
gate2007-it
data-structure
binary-search-tree
normal
+30
votes
5
answers
4
GATE2017-1-36
Consider the C functions foo and bar given below: int foo(int val) { int x=0; while(val > 0) { x = x + foo(val--); } return val; } int bar(int val) { int x = 0; while(val > 0) { x= x + bar( ... will result in: Return of $6$ and $6$ respectively. Infinite loop and abnormal termination respectively. Abnormal termination and infinite loop respectively. Both terminating abnormally.
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
384k
points)
|
6.6k
views
gate2017-1
programming-in-c
programming
normal
+28
votes
8
answers
5
GATE2017-2-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 _______
asked
Feb 14, 2017
in
Programming
by
Madhav
Active
(
2k
points)
|
7.5k
views
gate2017-2
programming-in-c
numerical-answers
+52
votes
5
answers
6
GATE2008-46
You are given the postorder traversal, $P$, of a binary search tree on the $n$ elements $1, 2, \dots, n$. You have to determine the unique binary search tree that has $P$ as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this? $\Theta(\log n)$ $\Theta(n)$ $\Theta(n\log n)$ None of the above, as the tree cannot be uniquely determined
asked
Sep 12, 2014
in
DS
by
Kathleen
Veteran
(
59.9k
points)
|
9.3k
views
gate2008
data-structure
binary-search-tree
normal
+3
votes
1
answer
7
what is the difference between type conversion and type casting in c ?
asked
May 10, 2016
in
Programming
by
Vivek Jain
Junior
(
883
points)
|
16k
views
+56
votes
3
answers
8
GATE2015-1-35
What is the output of the following C code? Assume that the address of $x$ is $2000$ (in decimal) and an integer requires four bytes of memory. int main () { unsigned int x [4] [3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; printf ("%u, %u, %u", x + 3, *(x + 3), *(x + 2) + 3); } $2036, 2036, 2036$ $2012, 4, 2204$ $2036, 10, 10$ $2012, 4, 6$
asked
Feb 13, 2015
in
Programming
by
makhdoom ghaya
Boss
(
41.2k
points)
|
6.6k
views
gate2015-1
programming
programming-in-c
normal
+45
votes
7
answers
9
GATE2004-85
A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ is: $\Large \min \left ( \substack{\text{number of leaf-nodes}\\\text{in left-subtree of $ ... worst-case time complexity of the program is? $\Theta (n)$ $\Theta (n \log n)$ $\Theta(n^2)$ $\Theta (n^2\log n)$
asked
Sep 19, 2014
in
DS
by
Kathleen
Veteran
(
59.9k
points)
|
7.1k
views
gate2004
binary-search-tree
normal
data-structure
+37
votes
8
answers
10
GATE2010-53
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
data-structure
hashing
difficult
gate2010
+37
votes
5
answers
11
GATE2013-44
Consider the following operation along with Enqueue and Dequeue operations on queues, where $k$ is a global parameter. MultiDequeue(Q){ m = k while (Q is not empty) and (m > 0) { Dequeue(Q) m = m – 1 } } What is the worst case time complexity of a sequence of $n$ queue operations on an initially empty queue? $Θ(n)$ $Θ(n + k)$ $Θ(nk)$ $Θ(n^2)$
asked
Aug 7, 2014
in
DS
by
gatecse
Boss
(
18.3k
points)
|
7.1k
views
gate2013
data-structure
algorithms
normal
queues
+30
votes
3
answers
12
GATE2017-1-55
The output of executing the following C program is _______________ . #include<stdio.h> int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return count; } void main() { static int x=0; int i=5; for(; i>0; i--) { x = x + total(i); } printf("%d\n", x); }
asked
Feb 14, 2017
in
Programming
by
srestha
Veteran
(
107k
points)
|
5.7k
views
gate2017-1
programming
programming-in-c
normal
numerical-answers
+40
votes
6
answers
13
GATE2016-2-15
$N$ items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the list in ... put together? $O(\log^{2} N)$ $O(N)$ $O(N^{2})$ $\Theta\left(N^{2}\log N\right)$
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
43.5k
points)
|
8.2k
views
gate2016-2
data-structure
linked-lists
time-complexity
normal
+47
votes
7
answers
14
GATE2017-1-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 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
gate2017-1
data-structure
linked-lists
normal
+2
votes
6
answers
15
GATE2019-46
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at random. The expected value of the distance between $a$ and $b$ in $T$ (ie., the number of edges in the unique path between $a$ and $b$) is (rounded off to $2$ decimal places) _________.
asked
Feb 7
in
DS
by
Arjun
Veteran
(
384k
points)
|
3.5k
views
gate2019
numerical-answers
data-structure
binary-tree
+31
votes
4
answers
16
GATE2016-1-10
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT ($n$ refers to the number of items in the queue) ? Both operations can be performed in $O(1)$ time. At most ... for both operations will be $\Omega (n)$. Worst case time complexity for both operations will be $\Omega (\log n)$
asked
Feb 12, 2016
in
DS
by
Sandeep Singh
Loyal
(
7.9k
points)
|
6k
views
gate2016-1
data-structure
queues
normal
+43
votes
6
answers
17
GATE2006-49
An implementation of a queue $Q$, using two stacks $S1$ and $S2$, is given below: void insert (Q, x) { push (S1, x); } void delete (Q) { if (stack-empty(S2)) then if (stack-empty(S1)) then { print( Q is empty ); return; } else while (!(stack-empty(S1))){ x=pop(S1); push(S2 ... $2m\leq y\leq 2n $ $ 2m\leq x<2n $ and $2m\leq y\leq n+m $ $ 2m\leq x<2n $ and $2m\leq y\leq 2n $
asked
Sep 26, 2014
in
DS
by
Rucha Shelke
Active
(
3.7k
points)
|
5.6k
views
gate2006
data-structure
queues
stack
normal
+41
votes
5
answers
18
GATE2016-2-34
A complete binary min-heap is made by including each integer in $[1, 1023]$ exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth $0$. The maximum depth at which integer $9$ can appear is _________.
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
43.5k
points)
|
5.3k
views
gate2016-2
data-structure
heap
normal
numerical-answers
+58
votes
8
answers
19
GATE2014-3-39
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
gate2014-3
data-structure
binary-search-tree
numerical-answers
normal
+34
votes
5
answers
20
GATE2003-23
In a min-heap with $n$ elements with the smallest element at the root, the $7^{th}$ smallest element can be found in time $\Theta (n \log n)$ $\Theta (n)$ $\Theta(\log n)$ $\Theta(1)$
asked
Sep 19, 2014
in
DS
by
Disha
(
121
points)
|
7.4k
views
gate2003
data-structure
heap
+21
votes
7
answers
21
GATE2017-1-20
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
gate2017-1
data-structure
trees
numerical-answers
+33
votes
5
answers
22
GATE2008-42
$G$ is a graph on $n$ vertices and $2n-2$ edges. The edges of $G$ can be partitioned into two edge-disjoint spanning trees. Which of the following is NOT true for $G$? For every subset of $k$ ... are at least $2$ edge-disjoint paths between every pair of vertices. There are at least $2$ vertex-disjoint paths between every pair of vertices.
asked
Sep 27, 2014
in
DS
by
Akshay Jindal
(
457
points)
|
6.4k
views
gate2008
data-structure
graphs
normal
+23
votes
10
answers
23
GATE2017-1-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); 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
gate2017-1
programming
normal
tricky
recursion
+14
votes
3
answers
24
Find address of element in 3d array
A is an array $[2.....6, 2.....8, 2.......10]$ of elements. The starting location is $500$. The location of an element $A(5, 5, 5)$ using column major order is __________.
asked
Dec 4, 2015
in
DS
by
shikharV
Active
(
4.3k
points)
|
8.6k
views
data-structure
arrays
algorithms
+17
votes
7
answers
25
GATE2017-2-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. 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
gate2017-2
data-structure
queues
+13
votes
3
answers
26
GATE2018-3
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let $n$ denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' be implemented by deletion ... $\theta(1), \theta(1)$ $\theta(1), \theta(n)$ $\theta(n), \theta(1)$ $\theta(n), \theta(n)$
asked
Feb 14, 2018
in
DS
by
gatecse
Boss
(
18.3k
points)
|
3k
views
gate2018
algorithms
data-structure
queues
normal
linked-lists
+28
votes
8
answers
27
GATE2011-29
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
binary-tree
normal
+38
votes
10
answers
28
GATE1994-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$ ... new representation is: $i+j$ $i+j-1$ $(j-1)+\frac{i(i-1)}{2}$ $i+\frac{j(j-1)}{2}$
asked
Oct 4, 2014
in
DS
by
Kathleen
Veteran
(
59.9k
points)
|
5.3k
views
gate1994
data-structure
arrays
normal
+2
votes
4
answers
29
GATE2019-27
Consider the following C program: #include <stdio.h> int r() { static int num=7; return num –; } int main() { for (r();r();r()) printf(“%d”,r()); return 0; } Which one of the following values will be displayed on execution of the programs? $41$ $52$ $63$ $630$
asked
Feb 7
in
Programming
by
Arjun
Veteran
(
384k
points)
|
2.2k
views
gate2019
programming-in-c
+25
votes
5
answers
30
GATE2017-1-13
Consider the following C code: #include<stdio.h> int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return; x = assignval (x,0); if (x) { x = ( ... as $x == NULL$ and not as shown. compiles successfully but execution may result in dangling pointer. compiles successfully but execution may result in memory leak.
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
384k
points)
|
5.9k
views
gate2017-1
programming-in-c
programming
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
Relax... But....
Barc : Arjun Sir
JEST Sample Question
Manipal institute of technology , Vellore Institute of technology, BARC, Interview M.Tech
What to do and scared for future
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
556
Exam Queries
550
Tier 1 Placement Questions
23
Job Queries
68
Projects
18
Follow @csegate
Recent Blog Comments
or u can upload the pdf file on google drive...
send me at
[email protected]
Do IITB/IISc also have winter admissions?
Selection criteria is same. Though cut off scores...
47,886
questions
52,257
answers
182,152
comments
67,673
users