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
Most answered questions in Programming and DS
55
votes
8
answers
61
GATE CSE 2004 | Question: 36
A circularly linked list is used to represent a Queue. A single variable $p$ is used to access the Queue. To which node should $p$ point such that both the operations $\text{enQueue}$ and $\text{deQueue}$ can be performed in constant time? rear node front node not possible with a single pointer node next to front
A circularly linked list is used to represent a Queue. A single variable $p$ is used to access the Queue. To which node should $p$ point such that both the operations $\t...
Kathleen
30.7k
views
Kathleen
asked
Sep 18, 2014
DS
gatecse-2004
data-structures
linked-list
normal
+
–
33
votes
8
answers
62
GATE CSE 2000 | Question: 1.14
Consider the following nested representation of binary trees: $(X \ Y \ Z)$ indicates $Y$ and $Z$ are the left and right subtrees, respectively, of node $X$. Note that $Y$ and $Z$ may be $NULL$ ... $(1 \ (2 \ 3 \ 4) \ (5 \ 6 \ 7))$ $(1 \ (2 \ 3 \ NULL) \ (4 \ 5))$
Consider the following nested representation of binary trees: $(X \ Y \ Z)$ indicates $Y$ and $Z$ are the left and right subtrees, respectively, of node $X$. Note that $Y...
Kathleen
10.9k
views
Kathleen
asked
Sep 14, 2014
DS
gatecse-2000
data-structures
binary-tree
easy
+
–
55
votes
8
answers
63
GATE CSE 2000 | Question: 1.2
An $n \times n$ array $v$ is defined as follows: $v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$ The sum of the elements of the array $v$ is $0$ $n-1$ $n^2 - 3n +2$ $n^2 \frac{\left(n+1\right)}{2}$
An $n \times n$ array $v$ is defined as follows:$v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$The sum of the elements of the array $v$ is$0$$n-1$$n...
Kathleen
9.7k
views
Kathleen
asked
Sep 14, 2014
DS
gatecse-2000
data-structures
array
easy
+
–
32
votes
8
answers
64
GATE CSE 1991 | Question: 01,x
Consider the following recursive definition of $fib$: fib(n) := if n = 0 then 1 else if n = 1 then 1 else fib(n-1) + fib(n-2) The number of times $fib$ is called (including the first call) for evaluation of $fib(7)$ is___________.
Consider the following recursive definition of $fib$:fib(n) := if n = 0 then 1 else if n = 1 then 1 else fib(n-1) + fib(n-2)The number of times $fib$ is called (includin...
Kathleen
10.1k
views
Kathleen
asked
Sep 12, 2014
Programming in C
gate1991
programming
recursion
normal
numerical-answers
+
–
4
votes
7
answers
65
NIELIT 2016 DEC Scientist B (CS) - Section B: 13
What will be output if you will compile and execute the following C code? void main() { printf("%d",sizeof(5.2)); } $4$ $8$ $2$ $16$
What will be output if you will compile and execute the following C code? void main() { printf("%d",sizeof(5.2)); }$4$$8$$2$$16$
admin
2.5k
views
admin
asked
Mar 31, 2020
Programming in C
nielit2016dec-scientistb-cs
programming-in-c
output
+
–
1
votes
7
answers
66
UGC NET CSE | January 2017 | Part 2 | Question: 23
Which of the following is a valid heap? $a$ $b$ $c$ $d$
Which of the following is a valid heap? $a$$b$$c$$d$
go_editor
1.5k
views
go_editor
asked
Mar 24, 2020
DS
ugcnetjan2017ii
data-structures
binary-heap
+
–
32
votes
7
answers
67
GATE CSE 2019 | Question: 40
Consider the following statements: The smallest element in a max-heap is always at a leaf node The second largest element in a max-heap is always a child of a root node A max-heap can be constructed from a binary search tree in $\Theta(n)$ time A binary search tree ... time Which of the above statements are TRUE? I, II and III I, II and IV I, III and IV II, III and IV
Consider the following statements:The smallest element in a max-heap is always at a leaf nodeThe second largest element in a max-heap is always a child of a root nodeA ma...
Arjun
20.4k
views
Arjun
asked
Feb 7, 2019
DS
gatecse-2019
data-structures
binary-heap
2-marks
+
–
54
votes
7
answers
68
GATE CSE 2017 Set 2 | Question: 43
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 ... i-1]) { swap(&array[i], &array[i-1]); done =0; } } } printf( %d , array[3]); } The output of the program is _______
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...
Arjun
16.8k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
algorithms
numerical-answers
identify-function
+
–
103
votes
7
answers
69
GATE CSE 2017 Set 1 | Question: 36
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 ... in: Return of $6$ and $6$ respectively. Infinite loop and abnormal termination respectively. Abnormal termination and infinite loop respectively. Both terminating abnormally.
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)...
Arjun
25.1k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
normal
recursion
+
–
38
votes
7
answers
70
GATE CSE 2017 Set 1 | Question: 20
Let $T$ be a tree with $10$ vertices. The sum of the degrees of all the vertices in $T$ is ________
Let $T$ be a tree with $10$ vertices. The sum of the degrees of all the vertices in $T$ is ________
Arjun
18.7k
views
Arjun
asked
Feb 14, 2017
DS
gatecse-2017-set1
data-structures
tree
easy
numerical-answers
+
–
87
votes
7
answers
71
GATE CSE 2017 Set 1 | Question: 13
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); ... and not as shown. compiles successfully but execution may result in dangling pointer. compiles successfully but execution may result in memory leak.
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...
Arjun
35.1k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
pointers
+
–
25
votes
7
answers
72
GATE CSE 2017 Set 2 | Question: 54
Consider the following C program. #include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n--; --n1; n-=n1; printf(“%d”, n); return 0; } The output of the program is ______
Consider the following C program.#include<stdio.h int main () { int m=10; int n, n1; n=++m; n1=m++; n ; n1; n-=n1; printf(“%d”, n); return 0; }The output of the prog...
Madhav
11.8k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
easy
+
–
10
votes
7
answers
73
GATE Overflow | Programming | Test 1 | Question: 3
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"); } ______
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");...
Arjun
1.8k
views
Arjun
asked
Oct 18, 2016
Programming in C
go-programming-1
programming-in-c
programming
numerical-answers
+
–
4
votes
7
answers
74
ISRO2014-49
Consider a single linked list where $F$ and $L$ are pointers to the first and last elements respectively of the linked list. The time for performing which of the given operations depends on the length of the linked list? Delete the first element of the list Interchange the first two elements of the list Delete the last element of the list Add an element at the end of the list
Consider a single linked list where $F$ and $L$ are pointers to the first and last elements respectively of the linked list. The time for performing which of the given op...
go_editor
15.8k
views
go_editor
asked
Jul 1, 2016
DS
isro2014
data-structures
linked-list
+
–
9
votes
7
answers
75
ISRO2011-19
If node A has three siblings and B is parent of A, what is the degree of A? 0 3 4 5
If node A has three siblings and B is parent of A, what is the degree of A?0345
shibu
7.3k
views
shibu
asked
Jun 15, 2016
DS
isro2011
data-structures
tree
+
–
50
votes
7
answers
76
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
13.8k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming
loop-invariants
normal
+
–
29
votes
7
answers
77
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.8k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming-in-c
normal
numerical-answers
parameter-passing
+
–
1
votes
7
answers
78
The maximum number of nodes on level i of a binary tree
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on level i of a binary tree is In the following answers, the operator '^' indicates power a) 2^i-1 b)2^i c)2^i+1 d)2^(i+1/2)
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on lev...
Akanksha Kesarwani
101k
views
Akanksha Kesarwani
asked
Jan 16, 2016
DS
binary-tree
data-structures
+
–
8
votes
7
answers
79
ISRO2014-32
What is the output of the following C program? #include<stdio.h> void main(void){ int shifty; shifty=0570; shifty=shifty>>4; shifty=shifty<<6; printf("The value of shifty is %o \n",shifty); } The value of shifty is 15c0 The value of shifty is 4300 The value of shifty is 5700 The value of shifty is 2700
What is the output of the following C program?#include<stdio.h void main(void){ int shifty; shifty=0570; shifty=shifty>>4; shifty=shifty<<6; printf("The value of shifty i...
ajit
7.9k
views
ajit
asked
Sep 2, 2015
Programming in C
programming-in-c
isro2014
output
+
–
54
votes
7
answers
80
GATE CSE 2015 Set 1 | Question: 33
Consider the following pseudo code, where $x$ and $y$ are positive integers. begin q := 0 r := x while r ≥ y do begin r := r - y q := q + 1 end end The post condition that needs to be satisfied after the program terminates is $\{ r = qx + y \wedge r < y\}$ ... $\{ y = qx + r \wedge 0 < r < y\}$ $\{ q + 1 < r - y \wedge y > 0\}$
Consider the following pseudo code, where $x$ and $y$ are positive integers.begin q := 0 r := x while r ≥ y do begin r := r - y q := q + 1 end endThe post condition tha...
makhdoom ghaya
15.4k
views
makhdoom ghaya
asked
Feb 13, 2015
Programming in C
gatecse-2015-set1
programming
loop-invariants
normal
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
...
309
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register