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
Recent questions in Programming and DS
50
votes
2
answers
4961
GATE CSE 2016 Set 1 | Question: 12
Consider the following "C" program. void f(int, short); void main() { int i = 100; short s = 12; short *p = &s; ____________; // call to f() } Which one of the following expressions , when placed in the blank above, will NOT result in a type checking error? $f(s, *s)$ $i = f(i,s)$ $f(i, *s)$ $f(i, *p)$
Consider the following "C" program.void f(int, short); void main() { int i = 100; short s = 12; short *p = &s; ____________; // call to f() } Which one of the following e...
Sandeep Singh
12.7k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
easy
+
–
41
votes
6
answers
4962
GATE CSE 2016 Set 2 | Question: 37
Consider the following program: int f (int * p, int n) { if (n <= 1) return 0; else return max (f (p+1, n-1), p[0] - p[1]); } int main () { int a[] = {3, 5, 2, 6, 4}; printf(" %d", f(a, 5)); } Note: $\max (x, y)$ returns the maximum of $x$ and $y$. The value printed by this program is ________.
Consider the following program:int f (int * p, int n) { if (n <= 1) return 0; else return max (f (p+1, n-1), p[0] - p ); } int main () { int a[] = {3, 5, 2, 6, 4}; ...
Akash Kanase
13.7k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming-in-c
normal
numerical-answers
recursion
+
–
65
votes
6
answers
4963
GATE CSE 2016 Set 2 | Question: 36
Consider the following New-order strategy for traversing a binary tree: Visit the root; Visit the right subtree using New-order; Visit the left subtree using New-order; The New-order traversal of the expression tree corresponding to the reverse polish expression 3 4 * 5 - 2 ^ 6 7 * 1 + - is given ... $1 \ 7 \ 6 * + \ 2 \ 5 \ 4 \ 3 \ * \ - \wedge -$
Consider the following New-order strategy for traversing a binary tree:Visit the root;Visit the right subtree using New-order;Visit the left subtree using New-order;The N...
Akash Kanase
16.9k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
binary-tree
normal
+
–
168
votes
17
answers
4964
GATE CSE 2016 Set 2 | Question: 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$.
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 _________.No...
Akash Kanase
50.1k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
binary-search-tree
normal
numerical-answers
+
–
73
votes
5
answers
4965
GATE CSE 2016 Set 2 | Question: 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 _________.
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 h...
Akash Kanase
26.0k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
binary-heap
normal
numerical-answers
+
–
50
votes
7
answers
4966
GATE CSE 2016 Set 2 | Question: 35
The following function computes $X^{Y}$ for positive integers $X$ and $Y$. int exp (int X, int Y) { int res =1, a = X, b = Y; while (b != 0) { if (b % 2 == 0) {a = a * a; b = b/2; } else {res = res * a; b = b - 1; } } return res; } Which one of the following ... $X^{Y} = a^{b}$ $(res * a)^{Y} = (res * X)^{b}$ $X^{Y} = res * a^{b}$ $X^{Y} = (res * a)^{b}$
The following function computes $X^{Y}$ for positive integers $X$ and $Y$.int exp (int X, int Y) { int res =1, a = X, b = Y; while (b != 0) { if (b % 2 == 0) {a =...
Akash Kanase
14.1k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming
loop-invariants
normal
+
–
29
votes
7
answers
4967
GATE CSE 2016 Set 2 | Question: 12
The value printed by the following program is _______. void f (int * p, int m) { m = m + 5; *p = *p + m; return; } void main () { int i=5, j=10; f (&i, j); printf ("%d", i+j); }
The value printed by the following program is _______.void f (int * p, int m) { m = m + 5; *p = *p + m; return; } void main () { int i=5, j=10; f (&i, j); p...
Akash Kanase
8.9k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming-in-c
normal
numerical-answers
parameter-passing
+
–
97
votes
6
answers
4968
GATE CSE 2016 Set 2 | Question: 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 ... together? $O(\log^{2} N)$ $O(N)$ $O(N^{2})$ $\Theta\left(N^{2}\log N\right)$
$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...
Akash Kanase
34.5k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
linked-list
time-complexity
normal
algorithms
+
–
1
votes
1
answer
4969
data structure
what is abstract data type ? please explain with example.
what is abstract data type ? please explain with example.
indrajeet
440
views
indrajeet
asked
Feb 5, 2016
DS
data-structures
+
–
1
votes
1
answer
4970
String Swapping
void swap(char **str_1,char **str_2){ char *temp = *str_1; *str_1 = *str_2; *str_2 = temp; } int main(){ char str1[20] = "india"; char str2[20] = "is great"; swap(&str1,&str2); printf("%s",str1); printf("%s", ... } if we replace str1[20] and str2[20] by *str1 and *str2. then string is swapped.but not in this case why?? please explain..
void swap(char str_1,char str_2){ char *temp = *str_1; *str_1 = *str_2; *str_2 = temp;}int main(){char str1[20] = "india";char str2[20] = "is great";swap(&str...
indrajeet
587
views
indrajeet
asked
Feb 3, 2016
Programming in C
programming-in-c
+
–
0
votes
4
answers
4971
output of this program is
int main(){ int n=1,sum =0; while(n<=10){ sum += n++*n++; } printf("Sum = %d\n",sum); return 0 } ans is 165 . i got 190.please explain??
int main(){ int n=1,sum =0; while(n<=10){ sum += n++*n++; } printf("Sum = %d\n",sum); return 0 }ans is 165 . i got 190.please explain??
indrajeet
1.0k
views
indrajeet
asked
Feb 3, 2016
Programming in C
programming-in-c
+
–
0
votes
1
answer
4972
functions
1 int main() { int b; b = f(20,30); printf("%d",b); return 0; } int f(int a,int b){ int z; z= a + b; return z; } this program compile fine and o/p is 50 2 int main() { int b; b = f(20,'a'); printf("%d",b); return 0; } int f(int a,char b){ int z; z= a + b; return z; } this give compilation error. I don't know why??Please explain
1 int main() { int b; b = f(20,30); printf("%d",b); return 0;}int f(int a,int b){ int z; z= a + b; return z;}this program compile fine and o/p is 502 i...
indrajeet
584
views
indrajeet
asked
Feb 3, 2016
Programming in C
programming-in-c
+
–
0
votes
1
answer
4973
Data structure used in TSP
Mayurk
1.0k
views
Mayurk
asked
Feb 3, 2016
Programming in C
data-structures
+
–
0
votes
1
answer
4974
Maximum number of nodes in binary tree
tamil93
823
views
tamil93
asked
Feb 3, 2016
1
votes
1
answer
4975
What is the output of the following program ?
What is the output of the following program ? void main() { int x=40, y=30, z=80; if(x<y<z) printf(“\n Hello world”); else printf(“\nGood by”); } A] Hello world B]Good by C]Compile time error D]None of these
What is the output of the following program ? void main() { int x=40, y=30, z=80; if(x<y<z) printf(“\n Hello world”); else printf(“\nGood by”);} A] Hello worldB]G...
Purple
2.2k
views
Purple
asked
Feb 3, 2016
Programming and DS
programming-in-c
algorithms
+
–
0
votes
1
answer
4976
operator precedence
int main(){ int a = 4,b = 5,c = 6; int k = ++a || ++b && c++; printf("%d %d %d %d",a,b,c,k); return 0; } o/p 5 5 6 1 Above code will not increment b and c why??even the precedence of logical And is more than logical Or
int main(){ int a = 4,b = 5,c = 6; int k = ++a || ++b && c++; printf("%d %d %d %d",a,b,c,k); return 0; }o/p 5 5 6 1Above code will not increment b and c why??even the pre...
indrajeet
4.8k
views
indrajeet
asked
Feb 2, 2016
Programming in C
programming-in-c
+
–
0
votes
3
answers
4977
how many recursive calls are there in tower of hanoi, is it 2^n-1 or 2^(n+1)-1??
Arpit Tripathi
3.2k
views
Arpit Tripathi
asked
Feb 2, 2016
DS
data-structures
stack
recursion
+
–
0
votes
1
answer
4978
check this
shivanisrivarshini
318
views
shivanisrivarshini
asked
Feb 2, 2016
1
votes
1
answer
4979
MSTs the graph have?
Shalini
334
views
Shalini
asked
Feb 1, 2016
Programming in C
minimum-spanning-tree
graph-theory
+
–
0
votes
3
answers
4980
what is output of program
int f(int); int main() { int b; b = f(20); printf("%d",b); return 0; } int f(int a){ a>10 ?return(20):return 10; }
int f(int); int main() { int b; b = f(20); printf("%d",b); return 0; } int f(int a){ a>10 ?return(20):return 10; }
indrajeet
799
views
indrajeet
asked
Feb 1, 2016
Programming in C
programming-in-c
+
–
Page:
« prev
1
...
244
245
246
247
248
249
250
251
252
253
254
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register