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
72
votes
4
answers
31
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
+
–
72
votes
4
answers
32
GATE CSE 2003 | Question: 2
Assume the following C variable declaration: int *A[10], B[10][10]; Of the following expressions: $A[2]$ $A[2][3]$ $B[1]$ $B[2][3]$ which will not give compile-time errors if used as left hand sides of assignment statements in a C program? I, II, and IV only II, III, and IV only II and IV only IV only
Assume the following C variable declaration:int *A[10], B[10][10];Of the following expressions:$A $$A [3]$$B $$B [3]$which will not give compile-time errors if used as le...
Kathleen
29.9k
views
Kathleen
asked
Sep 16, 2014
Programming in C
gatecse-2003
programming
programming-in-c
easy
pointers
+
–
71
votes
9
answers
33
GATE CSE 2019 | Question: 46
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at random. The expected value of the distance between $a$ and $b$ in $T$ (ie., the number of edges in the unique path between $a$ and $b$) is (rounded off to $2$ decimal places) _________.
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at ...
Arjun
30.3k
views
Arjun
asked
Feb 7, 2019
DS
gatecse-2019
numerical-answers
data-structures
binary-tree
2-marks
+
–
71
votes
9
answers
34
GATE CSE 2015 Set 2 | Question: 31
A Young tableau is a $2D$ array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with $\infty$, and hence there cannot be any entry to the right of, or below a $\infty$. The following Young tableau ... The minimum number of entries (other than $1$) to be shifted, to remove $1$ from the given Young tableau is _____.
A Young tableau is a $2D$ array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with $\infty$, and hence there cannot be...
go_editor
13.0k
views
go_editor
asked
Feb 12, 2015
DS
gatecse-2015-set2
databases
array
normal
numerical-answers
+
–
70
votes
13
answers
35
GATE CSE 2017 Set 2 | Question: 55
Consider the following C program. #include<stdio.h> #include<string.h> int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; } The output of the program is _______
Consider the following C program.#include<stdio.h #include<string.h int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; }T...
Madhav
27.5k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
array
pointers
+
–
68
votes
5
answers
36
GATE CSE 2017 Set 1 | Question: 55
The output of executing the following C program is _______________ . #include<stdio.h> int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return count; } void main() { static int x=0; int i=5; for(; i>0; i--) { x = x + total(i); } printf("%d\n", x); }
The output of executing the following C program is _______________ .#include<stdio.h int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return c...
srestha
22.2k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
67
votes
14
answers
37
GATE CSE 2018 | Question: 46
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
gatecse
38.7k
views
gatecse
asked
Feb 14, 2018
DS
gatecse-2018
binary-heap
numerical-answers
combinatory
2-marks
+
–
67
votes
2
answers
38
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
+
–
67
votes
4
answers
39
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
+
–
65
votes
9
answers
40
GATE CSE 2016 Set 1 | Question: 38
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$ ... integer value of $x$, for which at least one shortest path between some pair of vertices will contain the edge with weight $x$ is ___________.
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$. W=$\begin{bmatrix} 0&2 &8 &...
Sandeep Singh
23.8k
views
Sandeep Singh
asked
Feb 12, 2016
DS
gatecse-2016-set1
data-structures
graph-theory
normal
numerical-answers
+
–
65
votes
6
answers
41
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
+
–
65
votes
9
answers
42
GATE IT 2004 | Question: 13
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to delete the node $x$ from the list ? $O(n)$ $O(\log^2 n)$ $O(\log n)$ $O(1)$
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to del...
Ishrat Jahan
24.6k
views
Ishrat Jahan
asked
Nov 1, 2014
DS
gateit-2004
data-structures
linked-list
normal
ambiguous
+
–
65
votes
4
answers
43
GATE CSE 2003 | Question: 63, ISRO2009-25
A data structure is required for storing a set of integers such that each of the following operations can be done in $O(\log n)$ time, where $n$ is the number of elements in the set. Deletion of the smallest element Insertion of an ... used but not a heap Both balanced binary search tree and heap can be used Neither balanced search tree nor heap can be used
A data structure is required for storing a set of integers such that each of the following operations can be done in $O(\log n)$ time, where $n$ is the number of elements...
Kathleen
20.1k
views
Kathleen
asked
Sep 17, 2014
DS
gatecse-2003
data-structures
easy
isro2009
binary-search-tree
+
–
64
votes
7
answers
44
GATE IT 2005 | Question: 50
In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most $2$. If the height of the tree is $h > 0$, then the minimum number of nodes in the tree is $2^{h-1}$ $2^{h-1} + 1$ $2^h - 1$ $2^h$
In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most $2$. If the height of the tree is $h 0$, then the m...
Ishrat Jahan
22.5k
views
Ishrat Jahan
asked
Nov 3, 2014
DS
gateit-2005
data-structures
binary-tree
normal
+
–
64
votes
3
answers
45
GATE IT 2008 | Question: 51
Consider the C program given below. What does it print? #include <stdio.h> int main () { int i, j; int a [8] = {1, 2, 3, 4, 5, 6, 7, 8}; for(i = 0; i < 3; i++) { a[i] = a[i] + 1; i++; } i--; for (j = 7; j > 4; j--) { int i = j/2; a[i] = a[i] - 1; } printf ("%d, %d", i, a[i]); } $2, 3$ $2, 4$ $3, 2$ $3, 3$
Consider the C program given below. What does it print?#include <stdio.h int main () { int i, j; int a [8] = {1, 2, 3, 4, 5, 6, 7, 8}; for(i = 0; i < 3; i++) { a[i] = a[i...
Ishrat Jahan
14.9k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
normal
array
+
–
62
votes
11
answers
46
GATE CSE 2015 Set 3 | Question: 26
Consider the following C program #include<stdio.h> int main() { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; printf("%d%d", ptr-p, **ptr); } The output of the program is _______.
Consider the following C program#include<stdio.h int main() { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int ptr = p; ptr++; print...
go_editor
22.3k
views
go_editor
asked
Feb 15, 2015
Programming in C
gatecse-2015-set3
programming
programming-in-c
normal
numerical-answers
pointers
+
–
62
votes
4
answers
47
GATE CSE 2015 Set 2 | Question: 17
Consider a complete binary tree where the left and right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is $\Omega(\log n)$ $\Omega(n)$ $\Omega(n \log n)$ $\Omega(n^2)$
Consider a complete binary tree where the left and right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is...
go_editor
16.0k
views
go_editor
asked
Feb 12, 2015
DS
gatecse-2015-set2
data-structures
binary-heap
normal
+
–
62
votes
11
answers
48
GATE IT 2007 | Question: 28
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collides with an existing one exceed $0.5$. $5$ $6$ $7$ $10$
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collide...
Ishrat Jahan
29.0k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2007
data-structures
hashing
probability
normal
+
–
62
votes
5
answers
49
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.3k
views
go_editor
asked
Sep 26, 2014
Programming in C
gatecse-2014-set1
programming
programming-in-c
easy
pointers
+
–
62
votes
4
answers
50
GATE CSE 2004 | Question: 40
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among $\text{union, intersection, membership, cardinality}$ will be the slowest? $\text{union}$ only $\text{intersection, membership}$ $\text{membership, cardinality}$ $\text{union, intersection}$
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among $\text{union, intersection, membership, cardinality}$ wil...
Kathleen
18.9k
views
Kathleen
asked
Sep 18, 2014
DS
gatecse-2004
data-structures
linked-list
normal
+
–
Page:
« prev
1
2
3
4
5
6
7
...
309
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register