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
Recent questions and answers in Programming and DS
0
votes
1
answer
1
Self doubt Data structures
Implement Linked list using stack.
answered
16 hours
ago
in
Programming
by
Akash Ghosh
(
37
points)

132
views
programminginc
+14
votes
3
answers
2
GATE200016
A recursive program to compute Fibonacci numbers is shown below. Assume you are also given an array $f [ 0\ldots m]$ with all elements initialized to $0.$ fib(n) { if (n > M) error (); if (n == 0) return 1; if (n == 1) ... values. Write the box number and the corresponding contents in your answer book. What is the time complexity of the resulting program when computing $fib(n)?$
answered
1 day
ago
in
Programming
by
techbd123
(
37
points)

1.1k
views
gate2000
algorithms
normal
descriptive
recursion
0
votes
1
answer
3
i want to read Tanenbaum Datastructure book. Can anyone tell me the source of pdf Tanenbaum Datastructure book ?
answered
2 days
ago
in
Programming
by
Bikram
Veteran
(
70.9k
points)

298
views
datastructure
0
votes
2
answers
4
pseudo code
int zap(int n) { if (n<=1) then zap =1; else zap = zap(n3)+zap(n1); } then the call zap(6) gives the values of zap Give the proper explanation
answered
4 days
ago
in
Programming
by
shivam001
(
303
points)

124
views
programminginc
recursion
+27
votes
11
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$
answered
4 days
ago
in
Programming
by
shivam001
(
303
points)

5k
views
gate20171
programming
normal
tricky
recursion
+1
vote
2
answers
6
CMI2017A06
What does the following function compute in terms of $n$ and $d$, for integer values of $d$ ? Note that the operation $/$ denotes floating point division, even if the arguments are both integers. function foo(n,d){ if (d == 0){ return 1; }else{ if (d < 0){ return foo(n,d+1)/n; ... values of $d$. $n \times d$ if $d>0$ ,$n\div d$ if $d<0$. $n \times d$ for all the values of $d$.
answered
4 days
ago
in
Programming
by
Ashwani Kumar 2
Boss
(
14.9k
points)

117
views
cmi2017
programming
output
0
votes
1
answer
7
Insertion in Hash table. (M.E.)
The number of different insertion sequences of numbers $\left \{ 7,20,32,50,66,77 \right \}$ on an initially empty hash table H of size $6$ and a hash function $h\left ( k \right )=k\mod6$ with linear probing scheme for collision resolution such that the hash table obtained ... ${\color{Blue} {2}}$ ${\color{Blue} {3}}$. ${\color{Blue} {4}}$ ${\color{Blue} {5}}$
answered
6 days
ago
in
DS
by
scholaraniket
(
183
points)

171
views
hashing
datastructure
+3
votes
3
answers
8
Made Easy Test Series: DSHash Table
Consider a hash table with $N$ slots. It is given that the collision resolution technique used in chaining. Assume simple uniform hashing, what is the probability that the last $k$ slots are unfilled after the first $'r'$ insertions? $A)\left ( 1\frac{N}{k} \right )^{r}$ ... $C)\left ( 1+\frac{N}{k} \right )^{r1}$ $D)\left ( 1\frac{k}{N} \right )^{r1}$
answered
6 days
ago
in
DS
by
scholaraniket
(
183
points)

94
views
datastructure
madeeasytestseries
hashing
+40
votes
9
answers
9
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$
answered
6 days
ago
in
DS
by
scholaraniket
(
183
points)

6.1k
views
datastructure
hashing
normal
gate2010
+5
votes
3
answers
10
GO2017Programming124
The output of the following C program will be (assume IEEE754 floating point representation) #include <stdio.h> int main() { float a = 0.25; if(a == 0.25) printf("Hello"); printf(" World"); } Hello World World Compile Error Hello
answered
6 days
ago
in
Programming
by
MRINMOY_HALDER
Active
(
2.1k
points)

828
views
go2017programming1
programming
+17
votes
5
answers
11
GATE19941.14
Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is the sequence $\text{1, 2, 3, 4, 5}$ in that order? $\text{3, 4, 5, 1, 2}$ $\text{3, 4, 5, 2, 1}$ $\text{1, 5, 2, 3, 4}$ $\text{5, 4, 3, 1, 2}$
answered
6 days
ago
in
DS
by
SUBRATO KUMAR
(
17
points)

5.4k
views
gate1994
datastructure
stack
normal
+41
votes
8
answers
12
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$
answered
6 days
ago
in
DS
by
k.eswar prasanth
(
117
points)

6.3k
views
gate2003
datastructure
stack
normal
+19
votes
2
answers
13
GATE2005IT58
Let $a$ be an array containing $n$ integers in increasing order. The following algorithm determines whether there are two distinct numbers in the array whose difference is a specified number $S > 0$. i = 0; j = 1; while (j < n ){ if (E) j++; else if (a[j]  a[i] == S) break; else i++; } if ( ... $a[j]  a[i] > S$ $a[j]  a[i] < S$ $a[i]  a[j] < S$ $a[i]  a[j] > S$
answered
Sep 8
in
Programming
by
scholaraniket
(
183
points)

1.6k
views
gate2005it
programming
normal
programminginc
+1
vote
1
answer
14
NPTEL CODING ASSIGNMENT
Consider a matrix M of integers. Divide M into 4 submatrices. These submatrices are called as Quadrants. Report the Quadrant number which has the smallest minimumelement. If two or more quadrants have same smallest minimum, report the smallest ... than 1 and less than 12 OUTPUT FORMAT: Print in a separate line, the quadrant number with the smallest minimumelement.
answered
Sep 6
in
Programming
by
ravi4407
(
11
points)

116
views
0
votes
1
answer
15
Dynamic Scoping
answered
Sep 6
in
Programming
by
nadeshseen
(
323
points)

48
views
+4
votes
7
answers
16
GO2017Programming13
What will be the output of the following code? #include <stdio.h> #include <string.h> int main() { char string[] = "Hello"; if(sizeof(string) <= strlen(string)) printf("1"); printf("0"); } ______
answered
Sep 4
in
Programming
by
sat_27
(
11
points)

722
views
go2017programming1
programminginc
programming
numericalanswers
0
votes
1
answer
17
ISI2017PCBB2(b)
Write a $C$ program to fins all permutations of a string (having at most 6 characters). For example, a string of $3$ characters like $"abc"$ has 6 possible permutations: $”abc", "acb", "bca", "bac", "cab", "cba".$
answered
Sep 1
in
Programming
by
satya753
(
93
points)

52
views
isi2017pcbb
programming
programminginc
descriptive
+1
vote
2
answers
18
How SelfReferential Structure works?
I have learnt that selfreferential structure is one which contains a structure of same type in it as an element. But I have a doubt regarding how that line is compiled successfully (i.e, how compiler knows how much space should be allocated and ... not yet finished? struct node { int data; struct node *next; }; correct me If I am wrong in understanding this.
answered
Aug 29
in
Programming
by
amarsharma
(
35
points)

143
views
programminginc
pointers
+2
votes
2
answers
19
PGEE 2019
for(int i=0; i<=100;i++) { if (i % 3 == 0) printf("Great); if(i%5 == 0) printf("India"); } Count the number of times GreatIndia is printed. 6 20 33 none of these
answered
Aug 29
in
Programming
by
lalitkumar0014
(
21
points)

247
views
iiithpgee
loop
counting
programming
+1
vote
1
answer
20
UGCNETJune2019II21
Consider the following pseudocode fragment in which an invariant for the loop is $m ^*x^k=p^n$ and $k \geq 0$ (here, $p$ and $n$ are integer variable that have been initialized): /* Preconditions : $p \geq 1 \wedge n \geq 0$ */ /* Assume that overflow never occurs ... */ } Which of the following must be true ar the end of the while loop? $x=p^n$ $m=p^n$ $p=x^n$ $p=m^n$
answered
Aug 28
in
Programming
by
amarsharma
(
35
points)

133
views
ugcnetjune2019ii
pseudocode
+22
votes
3
answers
21
GATE200610
In a binary max heap containing $n$ numbers, the smallest element can be found in time $O(n)$ $O(\log n)$ $O(\log \log n)$ $O(1)$
answered
Aug 27
in
DS
by
JashanArora
(
313
points)

3.2k
views
gate2006
datastructure
heap
easy
0
votes
1
answer
22
Ace Test Series: Programming & DS  Programming In C
answered
Aug 22
in
Programming
by
abhishekdave1
(
17
points)

132
views
programming
programminginc
acetestseries
0
votes
1
answer
23
C POINTER
int f(int x, int *py, int **ppz) { int y, z; **ppz += 1; z = **ppz; *py += 2; y = *py; x += 3; return x + y + z; } void main() { int c, *b, **a; c = 4; b = &c; a = &b; printf("%d ", f(c, b, a)); return 0; } Run on IDE (A) 18 (B) 19 (C) 21 (D) 22
answered
Aug 22
in
Programming
by
nishanthcse
(
11
points)

91
views
+2
votes
3
answers
24
Ace Test Series: Programming & DS  Programming In C
I am getting 'cd' , but answer is given as 'gh' . How come ??
answered
Aug 22
in
Programming
by
abhishekdave1
(
17
points)

293
views
acetestseries
programming
programminginc
arrayofpointers
+48
votes
8
answers
25
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.
answered
Aug 21
in
DS
by
AbhayPrajapati
(
21
points)

7.7k
views
gate20171
datastructure
linkedlists
normal
+37
votes
3
answers
26
GATE20012.18
Consider the following three C functions: $[P1]$ int *g(void) { int x = 10; return (&x); } $[P2]$ int *g(void) { int *px; *px = 10; return px; } $[P3]$ int *g(void) { int *px; px = (int*) malloc (sizeof(int)); *px = 10; return px; } Which of the above three functions are likely to cause problems with pointers? Only $P3$ Only $P1$ and $P3$ Only $P1$ and $P2$ $P1, P2$ and $P3$
answered
Aug 19
in
Programming
by
JashanArora
(
313
points)

5.1k
views
gate2001
programming
programminginc
normal
0
votes
2
answers
27
Programming
The program fragment: int i= 263; putchar (i) (a) prints 263 (b) prints the ASCII equivalent of 263 (c) rings the bell (d) prints garbage
answered
Aug 19
in
Programming
by
digvijaydeshmukh
(
27
points)

86
views
programminginc
+1
vote
1
answer
28
MadeEasy Test Series: Programming & DS  Programming In C
answered
Aug 17
in
Programming
by
Nigam Modi
(
21
points)

137
views
madeeasytestseries
programming
pointers
arrays
0
votes
1
answer
29
gate : Heap questions
An array of integers of size n can be converted into a heap by adjusting the heaps rooted at each internal node of the complete binary tree starting at the node ⌊(n  1) /2⌋, and doing this adjustment up to the root node (root node is at index 0) in the order ⌊(n ... n) O (n log log n) O(n log n) I dont get what question meant can ny implemented on following array 1,2,3,4,5 ?
answered
Aug 16
in
DS
by
gorya506
(
173
points)

191
views
0
votes
1
answer
30
Can one describe it in easy meaning ?
An algorithm performs (log N)1/2 find operations , N insert operations, (log N)1/2 delete operations, and (log N)1/2 decreasekey operations on a set of data items with keys drawn from a linearly ordered set . For ... to achieve the best total asymptotic complexity considering all the operations? Unsorted array Min  heap Sorted array Sorted doubly linked list
answered
Aug 16
in
DS
by
gorya506
(
173
points)

32
views
+2
votes
3
answers
31
data structure
answered
Aug 16
in
DS
by
gorya506
(
173
points)

96
views
0
votes
1
answer
32
Data structure Set 221
Following keys have to be inserted in exact order into the hash table with $9$ slots. $5, 28, 19, 15, 20, 33, 12, 17, 10$ The auxiliary hash functions is $h(k)=K$ mod table size, where table size is $9$ . Which of the following represent the contents of the hash table in correct ... $10,28,19,20,12,5,15,33,17$ $33,28,19,20,12,5,15,10,17$ $20,28,19,10,12,5,15,33,17$
answered
Aug 16
in
Programming
by
Anwesha_Mishra
(
259
points)

41
views
dsset2017
+35
votes
6
answers
33
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)$
answered
Aug 16
in
DS
by
iarnav
Loyal
(
8k
points)

8.2k
views
gate2003
datastructure
heap
+1
vote
1
answer
34
Complexity
What is the time complexity of adding an element at the front of a circular linked list ? O(n) or theta(n) ? How to find whether it is O or theta ?
answered
Aug 16
in
DS
by
gorya506
(
173
points)

44
views
0
votes
1
answer
35
Data structure Set 25
Consider the following sequence $( 50,17,14,8, 13,10, 2,5,7,12)$ what is the Minimum number of interchanges required to make it Max heap? $4$ $2$ $3$ $0$
answered
Aug 16
in
Programming
by
Anwesha_Mishra
(
259
points)

23
views
dsset2017
+1
vote
2
answers
36
MadeEasy Subject Test: Programming & DS  Trees
A 4ary tree,i.e. each node has either 0 or 4 children tree has 20 leaf nodes. Then the total number of nodes in the tree are ____.
answered
Aug 16
in
DS
by
gorya506
(
173
points)

87
views
madeeasytestseries
datastructure
trees
+1
vote
1
answer
37
AVL Tree
Suppose we have an AVL tree of n nodes and any change in the tree violates the AVL tree property then : S1: If we insert an element in the tree, maximum 2 Rotations are required to make the Tree AVL again. S2: If we delete an element from the tree, maximum 2 Rotations are required to make tree AVL again Which are correct statements?
answered
Aug 15
in
DS
by
gorya506
(
173
points)

95
views
avltree
datastructure
tree
0
votes
1
answer
38
Testbook Test Series: Programming & DS  Stack
A queue is implemented using two stacks S1 and S2. Initially the queue contains 1, 2, 3, 4 from front to rear. The following operations are performed in the queue: delete, insert (5), delete, Then how many total no. of push and pop operations are needed to perform ... ? a) Push: 12 Pop: 13 b) Push: 15 Pop: 16 c) Push: 11 Pop: 10 d) Push: 12 Pop: 11
answered
Aug 15
in
DS
by
gorya506
(
173
points)

156
views
testbooktestseries
data
datastructure
stack
0
votes
1
answer
39
#DS Inserting elements into Min Heap?
The number of distinct min heap are possible with keys 1, 2, 3, 4, 5 are ________. I know, there are variance of this question for Max heap and even for Min heap, the answer won't change, but I just wanna know if my technique is right or not. ===== ... any value. > Lastly the right sub tree => 1C1 = 1 Totally  1*4C3*1*2*1 = 8. Is this approach correct?
answered
Aug 15
in
DS
by
gorya506
(
173
points)

120
views
algorithms
binaryheap
heap
datastructure
0
votes
1
answer
40
Ace Test Series: Data Structures  Circular Linked List
answered
Aug 15
in
DS
by
gorya506
(
173
points)

75
views
acetestseries
datastructure
linkedlists
To see more, click for all the
questions in this category
.
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
GATE 2020 Application Form Opened!
My GATE Preparation Journey
ISI MTECH CS 2019 INTERVIEW EXPERIENCE
IIT HYDERABAD MTECH TA INTERVIEW EXPERIENCE
How to prepare for GATE with a fulltime job??
All categories
General Aptitude
1.8k
Engineering Mathematics
7.3k
Digital Logic
2.9k
Programming and DS
4.9k
Programming
3.5k
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.5k
Others
1.6k
Admissions
595
Exam Queries
576
Tier 1 Placement Questions
23
Job Queries
72
Projects
17
Follow @csegate
Recent questions and answers in Programming and DS
Recent Blog Comments
will pdfs be uploaded ?
6th...
Sir
4th...
49,984
questions
55,135
answers
190,487
comments
85,111
users