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 viewed questions in Programming and DS
58
votes
3
answers
121
GATE CSE 2016 Set 1 | Question: 15
Consider the following C program. # include <stdio.h> void mystery (int *ptra, int *ptrb) { int *temp; temp = ptrb; ptrb =ptra; ptra = temp; } int main () { int a = 2016, b=0, c= 4, d = 42; mystery (&a, &b); if (a < c) mystery (&c, &a); mystery (&a, &d); printf("%d\n", a); } The output of the program is _________.
Consider the following C program.# include <stdio.h void mystery (int *ptra, int *ptrb) { int *temp; temp = ptrb; ptrb =ptra; ptra = temp; } int main () { int a...
Sandeep Singh
17.9k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
easy
numerical-answers
parameter-passing
+
–
2
votes
1
answer
122
ISRO2008-71
The time required to search an element in a linked list of length n is $O(\log_2 n)$ $O(n)$ $O(1)$ $O(n^2)$
The time required to search an element in a linked list of length n is$O(\log_2 n)$$O(n)$$O(1)$$O(n^2)$
go_editor
17.9k
views
go_editor
asked
Jun 13, 2016
DS
isro2008
data-structures
linked-list
time-complexity
+
–
44
votes
4
answers
123
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.7k
views
Kathleen
asked
Sep 12, 2014
Programming in C
gatecse-2008
programming
programming-in-c
normal
parameter-passing
+
–
3
votes
1
answer
124
what is the difference between type conversion and type casting in c ?
Vivek Jain
17.5k
views
Vivek Jain
asked
May 10, 2016
48
votes
4
answers
125
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.5k
views
Kathleen
asked
Sep 14, 2014
DS
gatecse-2000
data-structures
binary-tree
normal
+
–
55
votes
6
answers
126
GATE CSE 2003 | Question: 90
Consider the function $f$ defined below. struct item { int data; struct item * next; }; int f(struct item *p) { return ((p == NULL) || (p->next == NULL)|| ((p->data <= p ->next -> data) && f(p- ... order of data value the elements in the list are sorted in non-increasing order of data value not all elements in the list have the same data value
Consider the function $f$ defined below.struct item { int data; struct item * next; }; int f(struct item *p) { return ((p == NULL) || (p->next == NULL)|| ((p->data <= p -...
Kathleen
17.5k
views
Kathleen
asked
Sep 17, 2014
DS
gatecse-2003
data-structures
linked-list
normal
+
–
67
votes
2
answers
127
GATE IT 2005 | Question: 13
A function $f$ defined on stacks of integers satisfies the following properties. $f(∅) = 0$ and $f (push (S, i)) = max (f(S), 0) + i$ for all stacks $S$ and integers $i$. If a stack $S$ contains the integers $2, -3, 2, -1, 2$ in order from bottom to top, what is $f(S)$? $6$ $4$ $3$ $2$
A function $f$ defined on stacks of integers satisfies the following properties. $f(∅) = 0$ and $f (push (S, i)) = max (f(S), 0) + i$ for all stacks $S$ and integers $i...
Ishrat Jahan
17.3k
views
Ishrat Jahan
asked
Nov 3, 2014
DS
gateit-2005
data-structures
stack
normal
+
–
62
votes
5
answers
128
GATE CSE 2014 Set 1 | Question: 10
Consider the following program in C language: #include <stdio.h> main() { int i; int*pi = &i; scanf("%d",pi); printf("%d\n", i+5); } Which one of the following statements is TRUE? Compilation fails. Execution ... $5$ more than the address of variable $i$. On execution, the value printed is $5$ more than the integer value entered.
Consider the following program in C language:#include <stdio.h main() { int i; int*pi = &i; scanf("%d",pi); printf("%d\n", i+5); }Which one of the following statements is...
go_editor
17.2k
views
go_editor
asked
Sep 26, 2014
Programming in C
gatecse-2014-set1
programming
programming-in-c
easy
pointers
+
–
2
votes
3
answers
129
UGC NET CSE | July 2018 | Part 2 | Question: 28
The maximum number of comparisons needed to sort 9 items using radix sort is (assume each item is 5 digit octal number): 45 72 360 450
The maximum number of comparisons needed to sort 9 items using radix sort is (assume each item is 5 digit octal number):4572360450
Pooja Khatri
17.1k
views
Pooja Khatri
asked
Jul 13, 2018
DS
ugcnetcse-july2018-paper2
data-structures
radix-sort
+
–
67
votes
4
answers
130
GATE CSE 2006 | Question: 13
A scheme for storing binary trees in an array $X$ is as follows. Indexing of $X$ starts at $1$ instead of $0$. the root is stored at $X[1]$. For a node stored at $X[i]$, the left child, if any, is stored in $X[2i]$ and the right child, if any, in $X[2i+1]$. To be able to store any binary tree on n vertices the minimum size of $X$ should be $\log_2 n$ $n$ $2n+1$ $2^n-1$
A scheme for storing binary trees in an array $X$ is as follows. Indexing of $X$ starts at $1$ instead of $0$. the root is stored at $X $. For a node stored at $X[i]$, th...
Rucha Shelke
17.0k
views
Rucha Shelke
asked
Sep 17, 2014
DS
gatecse-2006
data-structures
binary-tree
normal
+
–
72
votes
4
answers
131
GATE CSE 2015 Set 2 | Question: 33
Which one of the following hash functions on integers will distribute keys most uniformly over $10$ buckets numbered $0$ to $9$ for $i$ ranging from $0$ to $2020$? $h(i) = i^2 \text{mod } 10$ $h(i) = i^3 \text{mod } 10$ $h(i) = (11 \ast i^2) \text{mod } 10$ $h(i) = (12 \ast i^2) \text{mod } 10$
Which one of the following hash functions on integers will distribute keys most uniformly over $10$ buckets numbered $0$ to $9$ for $i$ ranging from $0$ to $2020$?$h(i) ...
go_editor
16.8k
views
go_editor
asked
Feb 12, 2015
DS
gatecse-2015-set2
data-structures
hashing
normal
+
–
54
votes
7
answers
132
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
+
–
42
votes
5
answers
133
GATE IT 2008 | Question: 76
A binary tree with $n > 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbours. $n_3$ can be expressed as $n_1 + n_2 - 1$ $n_1 -2$ $[((n_1 + n_2)/2)]$ $n_2 - 1$
A binary tree with $n 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbo...
Ishrat Jahan
16.8k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2008
data-structures
binary-tree
normal
+
–
55
votes
3
answers
134
GATE CSE 2014 Set 1 | Question: 3
Let $G=(V,E)$ be a directed graph where $V$ is the set of vertices and $E$ the set of edges. Then which one of the following graphs has the same strongly connected components as $G$ ? $G_1$ = $(V,E_1)$ ... $u$ to $v$ in $E\}$ $G_4$ = $(V_4,E)$ where $V_4$ is the set of vertices in $G$ which are not isolated
Let $G=(V,E)$ be a directed graph where $V$ is the set of vertices and $E$ the set of edges. Then which one of the following graphs has the same strongly connected compon...
go_editor
16.7k
views
go_editor
asked
Sep 26, 2014
DS
gatecse-2014-set1
data-structures
graph-theory
ambiguous
+
–
37
votes
5
answers
135
GATE CSE 1998 | Question: 1.24
Which of the following statements is false? A tree with a $n$ nodes has $(n – 1)$ edges A labeled rooted binary tree can be uniquely constructed given its postorder and preorder traversal results. A complete binary tree with $n$ internal nodes has $(n + 1)$ leaves. The maximum number of nodes in a binary tree of height h is $2^{h+1} - 1$
Which of the following statements is false? A tree with a $n$ nodes has $(n – 1)$ edges A labeled rooted binary tree can be uniquely constructed given its postorder and...
Kathleen
16.7k
views
Kathleen
asked
Sep 25, 2014
DS
gate1998
data-structures
tree
multiple-selects
normal
+
–
2
votes
3
answers
136
The minimum number of temporary variables needed to swap the contents of two variables?
The minimum number of temporary variables needed to swap the contents of two variables is: (a) 1 (b) 2 (c) 3 (d) 0
The minimum number of temporary variables needed to swap the contents of two variables is:(a) 1 (b) 2(c) 3 (d) 0
goku
16.6k
views
goku
asked
Sep 14, 2015
Programming in C
programming
+
–
33
votes
10
answers
137
GATE CSE 2017 Set 1 | Question: 6
Let $T$ be a binary search tree with $15$ nodes. The minimum and maximum possible heights of $T$ are: Note: The height of a tree with a single node is $0$. $4$ and $15$ respectively. $3$ and $14$ respectively. $4$ and $14$ respectively. $3$ and $15$ respectively.
Let $T$ be a binary search tree with $15$ nodes. The minimum and maximum possible heights of $T$ are:Note: The height of a tree with a single node is $0$.$4$ and $15$ res...
Arjun
16.6k
views
Arjun
asked
Feb 14, 2017
DS
gatecse-2017-set1
data-structures
binary-search-tree
easy
+
–
65
votes
6
answers
138
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.6k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
binary-tree
normal
+
–
33
votes
4
answers
139
GATE CSE 2021 Set 1 | Question: 2
Let $P$ be an array containing $n$ integers. Let $t$ be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of $n$ elements. Which one of the following choices is correct ... $t>\lceil \log_2(n)\rceil \text{ and } t\leq n$
Let $P$ be an array containing $n$ integers. Let $t$ be the lowest upper bound on the number of comparisons of the array elements, required to find the min...
Arjun
16.5k
views
Arjun
asked
Feb 18, 2021
DS
gatecse-2021-set1
data-structures
array
1-mark
+
–
33
votes
4
answers
140
GATE CSE 2007 | Question: 38, ISRO2016-27
The following postfix expression with single digit operands is evaluated using a stack: $8 \ 2 \ 3 \ {}^\hat{} ∕ \ 2 \ 3 * + 5 \ 1 * -$ Note that $^\hat{}$ is the exponentiation operator. The top two elements of the stack after the first $*$ is evaluated are $6, 1$ $5, 7$ $3, 2$ $1, 5$
The following postfix expression with single digit operands is evaluated using a stack:$$8 \ 2 \ 3 \ {}^\hat{} ∕ \ 2 \ 3 * + 5 \ 1 * -$$Note that $^\hat{}$ is the ex...
Kathleen
16.4k
views
Kathleen
asked
Sep 21, 2014
DS
gatecse-2007
data-structures
stack
normal
infix-prefix
isro2016
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
10
11
12
...
309
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register