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
Hot 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
+93
votes
14
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
(
41.9k
points)

13.7k
views
gate20162
datastructures
binarysearchtree
normal
numericalanswers
+100
votes
8
answers
2
GATE2007IT29
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
(
16.3k
points)

12.9k
views
gate2007it
datastructures
binarysearchtree
normal
+62
votes
7
answers
3
GATE2017153
Consider the following C program. #include<stdio.h> #include<string.h> void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s)  strlen(t)) > c) ? strlen(s) : strlen(t); printf("%d\n", len); } void main() ... is defined in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
asked
Feb 14, 2017
in
Programming
by
srestha
Veteran
(
119k
points)

8.8k
views
gate20171
programming
programminginc
normal
numericalanswers
+40
votes
9
answers
4
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)

9.2k
views
gate20172
programminginc
numericalanswers
+49
votes
6
answers
5
GATE2017136
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
(
431k
points)

8.7k
views
gate20171
programminginc
programming
normal
+52
votes
8
answers
6
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.1k
points)

8.8k
views
gate20171
datastructures
linkedlists
normal
+74
votes
9
answers
7
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.2k
points)

10.1k
views
gate20161
datastructures
queues
difficult
numericalanswers
+70
votes
5
answers
8
GATE2015135
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
(
30.8k
points)

8.4k
views
gate20151
programming
programminginc
normal
+38
votes
5
answers
9
GATE2017155
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
(
119k
points)

7.3k
views
gate20171
programming
programminginc
normal
numericalanswers
+15
votes
7
answers
10
GATE201946
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, 2019
in
DS
by
Arjun
Veteran
(
431k
points)

6.7k
views
gate2019
numericalanswers
datastructures
binarytree
+34
votes
6
answers
11
GATE2017113
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
(
431k
points)

7.8k
views
gate20171
programminginc
programming
+19
votes
9
answers
12
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)

8.5k
views
gate20172
datastructures
queues
+40
votes
6
answers
13
GATE200842
$G$ is a graph on $n$ vertices and $2n2$ edges. The edges of $G$ can be partitioned into two edgedisjoint spanning trees. Which of the following is NOT true for $G$? For every subset of $k$ ... are at least $2$ edgedisjoint paths between every pair of vertices. There are at least $2$ vertexdisjoint paths between every pair of vertices.
asked
Sep 27, 2014
in
DS
by
Akshay Jindal
(
385
points)

8.4k
views
gate2008
datastructures
graphs
normal
+40
votes
6
answers
14
GATE200323
In a minheap 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
(
81
points)

9.4k
views
gate2003
datastructures
heap
+47
votes
9
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
(
105k
points)

7k
views
datastructures
hashing
normal
gate2010
+63
votes
5
answers
16
GATE200846
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
(
52.2k
points)

11.8k
views
gate2008
datastructures
binarysearchtree
normal
+55
votes
9
answers
17
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)

6.8k
views
gate20141
datastructures
binarytree
numericalanswers
normal
+17
votes
7
answers
18
GATE20182
Consider the following C program: #include<stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c", *((char*)q+1), *((char*)q+2)); return 0; } The output of this program is: 0, c 0, a+2 '0', 'a+2' '0', 'c'
asked
Feb 14, 2018
in
Programming
by
gatecse
Boss
(
17.5k
points)

4.9k
views
gate2018
programminginc
programming
structures
pointers
normal
+13
votes
9
answers
19
GATE201927
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, 2019
in
Programming
by
Arjun
Veteran
(
431k
points)

4.6k
views
gate2019
programminginc
programming
+30
votes
3
answers
20
GATE19891vii, ISRO201514
A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols $S1$ to $S7$ initially entered using a hashing function with linear probing. The maximum number of comparisons needed in searching an item that is not present is $4$ $5$ $6$ $3$
asked
Jun 1, 2015
in
DS
by
Anu
Loyal
(
5.8k
points)

7.2k
views
hashing
isro2015
gate1989
datastructures
normal
+34
votes
7
answers
21
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.2k
points)

8.4k
views
gate20161
datastructures
graphs
normal
numericalanswers
+31
votes
7
answers
22
GATE2017243
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$: int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done =0; int i; while (done==0) { done =1; for (i=0; i<=4; i++) { if ( ... ; array[i1]) { swap(&array[i], &array[i1]); done =0; } } } printf( %d , array[3]); } The output of the program is _______
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
431k
points)

5.5k
views
gate20172
programming
algorithms
numericalanswers
identifyfunction
+54
votes
7
answers
23
GATE200485
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 leafnodes}\\\text{in leftsubtree of $ ... worstcase 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
(
52.2k
points)

9.2k
views
gate2004
binarysearchtree
normal
datastructures
+45
votes
9
answers
24
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 operation ... 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
(
52.2k
points)

7.2k
views
gate2003
datastructures
stack
normal
+38
votes
5
answers
25
GATE2016236
Consider the following Neworder strategy for traversing a binary tree: Visit the root; Visit the right subtree using Neworder; Visit the left subtree using Neworder; The Neworder traversal of the expression tree corresponding to the reverse polish expression 3 4 * 5  2 ^ 6 7 * 1 +  is given by: ... $1 \ 7 \ 6 * + \ 2 \ 5 \ 4 \ 3 \ * \  \wedge $
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
41.9k
points)

5.3k
views
gate20162
datastructures
binarytree
normal
+50
votes
6
answers
26
GATE2016215
$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 decreasekey 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
(
41.9k
points)

10.9k
views
gate20162
datastructures
linkedlists
timecomplexity
normal
+48
votes
5
answers
27
GATE2006IT50
Which one of the choices given below would be printed when the following program is executed? #include <stdio.h> void swap (int *x, int *y) { static int *temp; temp = x; x = y; y = temp; } void printab () { static int i, a = 3, b = 6; i = 0; while (i <= 4) { if ((i++)%2 == 1) continue; ... $a = 12, b = 9$ $a = 3, b = 6$ $a = 3, b = 6$ $a = 6, b = 3$ $a = 15, b = 12$
asked
Nov 1, 2014
in
Programming
by
Ishrat Jahan
Boss
(
16.3k
points)

6k
views
gate2006it
programming
programminginc
normal
+21
votes
4
answers
28
GATE200937,ISRODEC201755
What is the maximum height of any AVLtree with $7$ nodes? Assume that the height of a tree with a single node is $0$. $2$ $3$ $4$ $5$
asked
Sep 22, 2014
in
DS
by
Kathleen
Veteran
(
52.2k
points)

8k
views
gate2009
datastructures
binarysearchtree
normal
isrodec2017
+28
votes
11
answers
29
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
(
431k
points)

5.8k
views
gate20171
programming
normal
tricky
recursion
+46
votes
5
answers
30
GATE201344
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
(
17.5k
points)

8.9k
views
gate2013
datastructures
algorithms
normal
queues
Page:
1
2
3
4
5
6
...
165
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
ISRO CSE 2020 PAPER ANALYSE
BARC OCES/DGFS 2020
ISI CMI PDF by GATE Overflow
Calculus Important Points
Management Trainee Recruitment COAL INDIA 2020
All categories
General Aptitude
1.9k
Engineering Mathematics
7.5k
Digital Logic
2.9k
Programming and DS
4.9k
Programming
3.5k
DS
1.3k
Algorithms
4.4k
Theory of Computation
6.2k
Compiler Design
2.1k
Operating System
4.5k
Databases
4.1k
CO and Architecture
3.4k
Computer Networks
4.2k
Non GATE
1.4k
Others
1.4k
Admissions
595
Exam Queries
573
Tier 1 Placement Questions
23
Job Queries
72
Projects
18
Follow @csegate
Recent Blog Comments
@nsaisirisha Yes they will give marks only...
When will the results be declared based on...
For the questions with two answers as per the...
@MiNiPanda Congrax mate for this success !
Mostly authentic links, it can be Stackoverflow,...
50,737
questions
57,333
answers
198,441
comments
105,199
users