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
+82
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.4k
points)

12.3k
views
gate20162
datastructure
binarysearchtree
normal
numericalanswers
+89
votes
7
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)

11.7k
views
gate2007it
datastructure
binarysearchtree
normal
+52
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
(
116k
points)

8.1k
views
gate20171
programming
programminginc
normal
numericalanswers
+34
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)

8.4k
views
gate20172
programminginc
numericalanswers
+48
votes
8
answers
5
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
(
7k
points)

8k
views
gate20171
datastructure
linkedlists
normal
+39
votes
6
answers
6
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
(
422k
points)

7.8k
views
gate20171
programminginc
programming
normal
+68
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)

9.1k
views
gate20161
datastructure
queues
difficult
numericalanswers
+18
votes
9
answers
8
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.9k
views
gate20172
datastructure
queues
+28
votes
6
answers
9
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
(
422k
points)

7k
views
gate20171
programminginc
programming
+34
votes
4
answers
10
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
(
116k
points)

6.5k
views
gate20171
programming
programminginc
normal
numericalanswers
+10
votes
7
answers
11
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
in
DS
by
Arjun
Veteran
(
422k
points)

5.4k
views
gate2019
numericalanswers
datastructure
binarytree
+37
votes
6
answers
12
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)

8.7k
views
gate2003
datastructure
heap
+42
votes
9
answers
13
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
(
104k
points)

6.3k
views
datastructure
hashing
normal
gate2010
+59
votes
5
answers
14
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.1k
points)

10.8k
views
gate2008
datastructure
binarysearchtree
normal
+27
votes
11
answers
15
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
(
422k
points)

5.2k
views
gate20171
programming
normal
tricky
recursion
+31
votes
7
answers
16
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)

7.7k
views
gate20161
datastructure
graphs
normal
numericalanswers
+42
votes
9
answers
17
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.1k
points)

6.6k
views
gate2003
datastructure
stack
normal
+25
votes
7
answers
18
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
(
422k
points)

5k
views
gate20172
programming
algorithms
numericalanswers
identifyfunction
+49
votes
7
answers
19
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.1k
points)

8.4k
views
gate2004
binarysearchtree
normal
datastructure
+7
votes
9
answers
20
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
in
Programming
by
Arjun
Veteran
(
422k
points)

3.6k
views
gate2019
programminginc
programming
+61
votes
3
answers
21
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
(
29.9k
points)

7.6k
views
gate20151
programming
programminginc
normal
+40
votes
11
answers
22
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)

6.3k
views
gate1994
datastructure
arrays
normal
+45
votes
6
answers
23
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.4k
points)

9.7k
views
gate20162
datastructure
linkedlists
timecomplexity
normal
+36
votes
4
answers
24
GATE20032
Assume the following C variable declaration: int *A[10], B[10][10]; Of the following expressions: $A[2]$ $A[2][3]$ $B[1]$ $B[2][3]$ which will not give compiletime errors if used as left hand sides of assignment statements in a C program? I, II, and IV only II, III, and IV only II and IV only IV only
asked
Sep 16, 2014
in
Programming
by
Kathleen
Veteran
(
52.1k
points)

6k
views
gate2003
programming
programminginc
easy
+66
votes
3
answers
25
GATE2014211
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set p to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set p correctly? $p = n * (n1) * (n2) / 6;$ $p = n * (n1) / 2 * (n2) / 3;$ $p = n * (n1) / 3 * (n2) / 2;$ $p = n * (n1) * (n2) / 6.0;$
asked
Sep 28, 2014
in
Programming
by
jothee
Veteran
(
104k
points)

4.5k
views
gate20142
programming
programminginc
normal
+40
votes
5
answers
26
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
(
16.6k
points)

8k
views
gate2013
datastructure
algorithms
normal
queues
+3
votes
1
answer
27
what is the difference between type conversion and type casting in c ?
asked
May 10, 2016
in
Programming
by
Vivek Jain
Junior
(
771
points)

16.1k
views
+14
votes
5
answers
28
GATE201845
Consider the following program written in pseudocode. Assume that $x$ and $y$ are integers. Count (x, y) { if (y !=1 ) { if (x !=1) { print("*"); Count (x/2, y); } else { y=y1; Count (1024, y); } } } The number of times that the $print$ statement is executed by the call $Count(1024, 1024)$ is _____
asked
Feb 14, 2018
in
Programming
by
gatecse
Boss
(
16.6k
points)

3.4k
views
gate2018
programminginc
numericalanswers
+37
votes
3
answers
29
GATE200657
Consider this C code to swap two integers and these five statements: the code void swap (int *px, int *py) { *px = *px  *py; *py = *px + *py; *px = *py  *px; } S1: will generate a compilation error S2: may generate a segmentation fault ... swap procedure correctly for some but not all valid input pointers S5: may add or subtract integers and pointers S1 S2 and S3 S2 and S4 S2 and S5
asked
Sep 26, 2014
in
Programming
by
Rucha Shelke
Active
(
3.3k
points)

5k
views
gate2006
programming
programminginc
normal
+33
votes
4
answers
30
GATE2016110
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.2k
points)

7k
views
gate20161
datastructure
queues
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
IIITH: Winter Research Admissions 2019 (For Spring 2020)
TIFR and JEST exam
Minimal Deterministic Finite Automata
To be aware of fake GATE test series
Standard Book Exercise Questions for Computer Science
All categories
General Aptitude
1.9k
Engineering Mathematics
7.4k
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.1k
Non GATE
1.4k
Others
1.7k
Admissions
595
Exam Queries
576
Tier 1 Placement Questions
23
Job Queries
72
Projects
17
Follow @csegate
Recent Blog Comments
Favorite is not working for blogs.. In favorites...
Favourite option does work. But list options...
Blog favorite button doesnt work?
@Arjun Sir can we have an option to save such...
Thanks Sir
50,666
questions
56,170
answers
193,842
comments
94,047
users