Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Highest voted questions in Programming and DS
48
votes
4
answers
91
GATE CSE 2000 | Question: 2.16
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited `in a postorder, inorder and preorder traversal respectively, of a complete binary tree. Which of the following is always true? LASTIN = LASTPOST LASTIN = LASTPRE LASTPRE = LASTPOST None of the above
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited in a postorder, inorder and preorder traversal respectively, of a complete binary tree. Which of the foll...
Kathleen
17.6k
views
Kathleen
asked
Sep 14, 2014
DS
gatecse-2000
data-structures
binary-tree
normal
+
–
47
votes
11
answers
92
GATE CSE 2017 Set 1 | Question: 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); ... printf("%d", n); } The output printed when $\text{fun1}(5)$ is called is $53423122233445$ $53423120112233$ $53423122132435$ $53423120213243$
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("...
Arjun
20.4k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
normal
tricky
recursion
+
–
47
votes
3
answers
93
GATE CSE 2015 Set 1 | Question: 23
What are the worst-case complexities of insertion and deletion of a key in a binary search tree? $\Theta(\log n)$ for both insertion and deletion $\Theta(n)$ for both insertion and deletion $\Theta(n)$ for insertion and $\Theta(\log n)$ for deletion $\Theta(\log n)$ for insertion and $\Theta(n)$ for deletion
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?$\Theta(\log n)$ for both insertion and deletion$\Theta(n)$ for both inser...
makhdoom ghaya
10.4k
views
makhdoom ghaya
asked
Feb 13, 2015
DS
gatecse-2015-set1
data-structures
binary-search-tree
easy
+
–
46
votes
5
answers
94
GATE CSE 2018 | Question: 29
#include<stdio.h> void fun1(char* s1, char* s2){ char* temp; temp = s1; s1 = s2; s2 = temp; } void fun2(char** s1, char** s2){ char* temp; temp = *s1; *s1 = *s2; *s2 = temp; } int main(){ char *str1="Hi", *str2 = "Bye"; fun1 ... of the program above is: $\text{Hi Bye Bye Hi}$ $\text{Hi Bye Hi Bye}$ $\text{Bye Hi Hi Bye}$ $\text{Bye Hi Bye Hi}$
#include<stdio.h void fun1(char* s1, char* s2){ char* temp; temp = s1; s1 = s2; s2 = temp; } void fun2(char s1, char s2){ char* temp; temp = *s1; *s1 = *s2; *s2 = temp;...
gatecse
15.1k
views
gatecse
asked
Feb 14, 2018
Programming in C
gatecse-2018
programming-in-c
pointers
parameter-passing
normal
programming
2-marks
+
–
46
votes
4
answers
95
GATE CSE 2012 | Question: 49
Consider the following C code segment. int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf( \n %d %d , a, b); } void prtFun(void) { static int a = 2; /* Line 2 */ int b = 1; a += ++b ... $\begin{array}{ll} \text{4} & \text{2} \\ \text{4} & \text{2} \\ \text{2} & \text{0} \\ \end{array}$
Consider the following C code segment.int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf(“ \n %d %d ”, a, ...
go_editor
10.1k
views
go_editor
asked
Apr 21, 2016
Programming in C
normal
gatecse-2012
programming-in-c
programming
+
–
46
votes
6
answers
96
GATE CSE 2012 | Question: 35
Suppose a circular queue of capacity $(n −1)$ elements is implemented with an array of $n$ elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, $REAR = FRONT = 0$. The conditions to detect ... : $(REAR+1) \mod n == FRONT$ full: $(FRONT+1) \mod n == REAR$ empty: $REAR == FRONT$
Suppose a circular queue of capacity $(n −1)$ elements is implemented with an array of $n$ elements. Assume that the insertion and deletion operations are carried out u...
gatecse
24.2k
views
gatecse
asked
Sep 26, 2014
DS
gatecse-2012
data-structures
queue
normal
+
–
46
votes
4
answers
97
GATE CSE 2005 | Question: 5
A program $P$ reads in $500$ integers in the range $[0, 100]$ representing the scores of $500$ students. It then prints the frequency of each score above $50$. What would be the best way for $P$ to store the frequencies? An array of $50$ numbers An array of $100$ numbers An array of $500$ numbers A dynamically allocated array of $550$ numbers
A program $P$ reads in $500$ integers in the range $[0, 100]$ representing the scores of $500$ students. It then prints the frequency of each score above $50$. What would...
Kathleen
20.7k
views
Kathleen
asked
Sep 22, 2014
DS
gatecse-2005
data-structures
array
easy
+
–
45
votes
6
answers
98
GATE CSE 1997 | Question: 6.2
Let $G$ be the graph with $100$ vertices numbered $1$ to $100$. Two vertices $i$ and $j$ are adjacent if $\vert i-j \vert =8$ or $\vert i-j \vert=12$. The number of connected components in $G$ is $8$ $4$ $12$ $25$
Let $G$ be the graph with $100$ vertices numbered $1$ to $100$. Two vertices $i$ and $j$ are adjacent if $\vert i-j \vert =8$ or $\vert i-j \vert=12$. The number of con...
Kathleen
9.0k
views
Kathleen
asked
Sep 29, 2014
DS
gate1997
data-structures
normal
graph-theory
+
–
45
votes
4
answers
99
GATE CSE 2012 | Question: 48
Consider the following C code segment. int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf( \n %d %d , a, b); } void prtFun(void) { static int a = 2; /* Line 2 */ int b = 1; a += + ... $\begin{array}{lll} 3 & & 1 & \\ 5 & & 2 & \\ 5 & & 2 & \end{array}$
Consider the following C code segment.int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf(“ \n %d %d ”, a, ...
gatecse
13.9k
views
gatecse
asked
Sep 29, 2014
Programming in C
gatecse-2012
programming
programming-in-c
normal
+
–
45
votes
8
answers
100
GATE CSE 1998 | Question: 2.14
Let $A$ be a two dimensional array declared as follows: A: array [1 …. 10] [1 ….. 15] of integer; Assuming that each integer takes one memory location, the array is stored in row-major order and the first element of the array is stored at location $100$, what is the address of the element $A[i][j]$? $15i+j+84$ $15j+i+84$ $10i+j+89$ $10j+i+89$
Let $A$ be a two dimensional array declared as follows:A: array [1 …. 10] [1 ….. 15] of integer;Assuming that each integer takes one memory location, the array is sto...
Kathleen
29.8k
views
Kathleen
asked
Sep 25, 2014
DS
gate1998
data-structures
array
easy
+
–
44
votes
11
answers
101
GATE CSE 2016 Set 1 | Question: 35
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 (n-1); 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$
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 (n-1); printf ("%d",d); } ...
Sandeep Singh
15.5k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
recursion
normal
+
–
44
votes
9
answers
102
GATE CSE 1998 | Question: 19b
Compute the post fix equivalent of the following expression $3^*\log(x+1)-\frac{a}{2}$
Compute the post fix equivalent of the following expression $3^*\log(x+1)-\frac{a}{2}$
Arjun
15.8k
views
Arjun
asked
Aug 29, 2015
DS
gate1998
stack
infix-prefix
descriptive
+
–
44
votes
3
answers
103
GATE CSE 2015 Set 3 | Question: 30
Consider the following two C code segments. $Y$ and $X$ are one and two dimensional arrays of size $n$ and $ n \times n$ respectively, where $2 \leq n \leq 10$. Assume that in both code segments, elements of $Y$ are initialized to $0$ ... $2$ are contiguous in main memory Only S2 is correct Only S3 is correct Only S1 and S2 are correct Only S1 and S3 are correct
Consider the following two C code segments. $Y$ and $X$ are one and two dimensional arrays of size $n$ and $ n \times n$ respectively, where $2 \leq n \leq 10$. Assume th...
go_editor
8.9k
views
go_editor
asked
Feb 15, 2015
Programming in C
gatecse-2015-set3
programming-in-c
normal
array
+
–
44
votes
3
answers
104
GATE IT 2006 | Question: 73
An array $X$ of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If the root node is at level $0$, the level of element $X[i]$, $i \neq 0$, is $\left \lfloor \log _2 i \right \rfloor$ ... $\left \lfloor \log _2 (i+1) \right \rfloor$ $\left \lceil \log _2 i \right \rceil$
An array $X$ of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If the root node is at level $0$, the le...
Ishrat Jahan
9.0k
views
Ishrat Jahan
asked
Nov 1, 2014
DS
gateit-2006
data-structures
binary-tree
normal
+
–
44
votes
5
answers
105
GATE IT 2006 | Question: 71
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. The index of the parent of element $X[i], i \neq 0$, is? $\left \lfloor \dfrac i 2 \right \rfloor$ $\left \lceil \dfrac{i-1}{2} \right \rceil$ $\left \lceil \dfrac i 2 \right \rceil$ $\left \lceil \dfrac i 2 \right \rceil - 1$
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. The index of the parent of element $X[...
Ishrat Jahan
13.7k
views
Ishrat Jahan
asked
Nov 1, 2014
DS
gateit-2006
data-structures
binary-tree
normal
+
–
44
votes
5
answers
106
GATE CSE 1997 | Question: 1.4
The concatenation of two lists is to be performed on $O(1)$ time. Which of the following implementations of a list should be used? Singly linked list Doubly linked list Circular doubly linked list Array implementation of list
The concatenation of two lists is to be performed on $O(1)$ time. Which of the following implementations of a list should be used?Singly linked listDoubly linked listCirc...
Kathleen
19.5k
views
Kathleen
asked
Sep 29, 2014
DS
gate1997
data-structures
linked-list
easy
+
–
44
votes
5
answers
107
GATE CSE 2006 | Question: 10
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)$
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)$
Rucha Shelke
20.8k
views
Rucha Shelke
asked
Sep 16, 2014
DS
gatecse-2006
data-structures
binary-heap
easy
+
–
44
votes
2
answers
108
GATE CSE 1991 | Question: 01,viii
The weighted external path length of the binary tree in figure is ______
The weighted external path length of the binary tree in figure is ______
Kathleen
13.7k
views
Kathleen
asked
Sep 12, 2014
DS
gate1991
binary-tree
data-structures
normal
numerical-answers
+
–
44
votes
4
answers
109
GATE CSE 2008 | Question: 60
What is printed by the following C program? int f(int x, int *py, int **ppz) { int y, z; **ppz += 1; z = **ppz; // corrected z = *ppz; to 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)); } $18$ $19$ $21$ $22$
What is printed by the following C program?int f(int x, int *py, int ppz) { int y, z; ppz += 1; z = ppz; // corrected z = *ppz; to z = ppz; *py += 2; y = *py; x += 3;...
Kathleen
17.9k
views
Kathleen
asked
Sep 12, 2014
Programming in C
gatecse-2008
programming
programming-in-c
normal
parameter-passing
+
–
43
votes
4
answers
110
TIFR CSE 2015 | Part B | Question: 4
First, consider the tree on the left. On the right, the nine nodes of the tree have been assigned numbers from the set $\left\{1, 2,\ldots,9\right\}$ so that for every node, the numbers in its left subtree and right subtree lie in disjoint intervals (that is, all numbers in one subtree ... $2^{4}.3^{2}.5.9=6480$ $2^{3}.3.5.9=1080$ $2^{4}=16$ $2^{3}.3^{3}=216$
First, consider the tree on the left. On the right, the nine nodes of the tree have been assigned numbers from the set $\left\{1, 2,\ldots,9\right\}$ so that for every ...
makhdoom ghaya
4.1k
views
makhdoom ghaya
asked
Dec 7, 2015
DS
tifr2015
binary-tree
combinatory
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
10
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register