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
77
votes
1
answer
81
GATE CSE 2015 Set 3 | Question: 48
Consider the following C program: #include<stdio.h> int main() { int i, j, k = 0; j=2 * 3 / 4 + 2.0 / 5 + 8 / 5; k-=--j; for (i=0; i<5; i++) { switch(i+k) { case 1: case 2: printf("\n%d", i+k); ... : printf("\n%d", i+k); default: printf("\n%d", i+k); } } return 0; } The number of times printf statement is executed is _______.
Consider the following C program:#include<stdio.h int main() { int i, j, k = 0; j=2 * 3 / 4 + 2.0 / 5 + 8 / 5; k-= j; for (i=0; i<5; i++) { switch(i+k) { case 1: case 2: ...
go_editor
22.5k
views
go_editor
asked
Feb 16, 2015
Programming in C
gatecse-2015-set3
programming
programming-in-c
switch-case
normal
numerical-answers
+
–
68
votes
5
answers
82
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.4k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
49
votes
3
answers
83
GATE CSE 2014 Set 3 | Question: 40
Consider a hash table with $100$ slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first $3$ slots are unfilled after the first $3$ insertions? $(97 \times 97 \times 97) / 100^3$ $(99 \times 98 \times 97) / 100^3$ $(97 \times 96 \times 95) / 100^3$ $(97 \times 96 \times 95 / (3! \times 100^3)$
Consider a hash table with $100$ slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first $3$ slots are unfi...
go_editor
22.0k
views
go_editor
asked
Sep 28, 2014
DS
gatecse-2014-set3
data-structures
hashing
probability
normal
+
–
29
votes
4
answers
84
GATE CSE 2020 | Question: 41
In a balanced binary search tree with $n$ elements, what is the worst case time complexity of reporting all elements in range $[a,b]$? Assume that the number of reported elements is $k$. $\Theta (\log n)$ $\Theta (\log n +k)$ $\Theta (k \log n)$ $\Theta ( n \log k)$
In a balanced binary search tree with $n$ elements, what is the worst case time complexity of reporting all elements in range $[a,b]$? Assume that the number of reported ...
Arjun
21.9k
views
Arjun
asked
Feb 12, 2020
DS
gatecse-2020
data-structures
binary-search-tree
2-marks
+
–
9
votes
3
answers
85
ISRO2011-62
The average depth of a binary search tree is $O(n^{0.5})$ $O(n)$ $O(\log n)$ $O(n \log n)$
The average depth of a binary search tree is$O(n^{0.5})$$O(n)$$O(\log n)$$O(n \log n)$
go_editor
21.5k
views
go_editor
asked
Jun 23, 2016
DS
isro2011
data-structures
binary-search-tree
time-complexity
+
–
3
votes
1
answer
86
Circular Linked List
In circular singly linked list, insertion of node requires modification of how many pointers? 1 pointers 2 pointers 3 pointers 4 pointers
In circular singly linked list, insertion of node requires modification of how many pointers?1 pointers2 pointers3 pointers 4 pointers
hacker16
21.4k
views
hacker16
asked
Nov 14, 2017
Programming in C
linked-list
data-structures
+
–
73
votes
2
answers
87
GATE CSE 2013 | Question: 42
What is the return value of $f(p,p)$, if the value of $p$ is initialized to $5$ before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value. int f (int &x, int c) { c = c - 1; if (c==0) return 1; x = x + 1; return f(x,c) * x; }
What is the return value of $f(p,p)$, if the value of $p$ is initialized to $5$ before the call? Note that the first parameter is passed by reference, whereas the second ...
gatecse
21.2k
views
gatecse
asked
Aug 7, 2014
Programming in C
gatecse-2013
compiler-design
normal
marks-to-all
numerical-answers
parameter-passing
runtime-environment
+
–
1
votes
1
answer
88
Asymptotic time complexity to add a node at the end of singly linked list.
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list? (a) O(1) (b) O(n) (c) θ (n) (d) θ (1) Confused between option (b) and (c) .
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?(a) O(1) (b...
arya_stark
21.0k
views
arya_stark
asked
Jul 4, 2018
DS
data-structures
linked-list
time-complexity
+
–
78
votes
4
answers
89
GATE CSE 2006 | Question: 57
Consider this C code to swap two integers and these five statements: the code void swap (int *px, int *py) { *px = *px - *py; *py = *px + *py; *px = *py - *px; } S1: will generate a compilation error S2: may generate a ... procedure correctly for some but not all valid input pointers S5: may add or subtract integers and pointers S1 S2 and S3 S2 and S4 S2 and S5
Consider this C code to swap two integers and these five statements: the codevoid swap (int *px, int *py) { *px = *px - *py; *py = *px + *py; *px = *py - *px; }S1...
Rucha Shelke
21.0k
views
Rucha Shelke
asked
Sep 26, 2014
Programming in C
gatecse-2006
programming
programming-in-c
normal
pointers
+
–
44
votes
5
answers
90
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
+
–
51
votes
4
answers
91
GATE CSE 2000 | Question: 1.17, ISRO2015-79
Consider the following C declaration: struct { short x[5]; union { float y; long z; } u; )t; Assume that the objects of the type short, float and long occupy $2$ bytes, $4$ bytes and $8$ bytes, respectively. The memory requirement for variable $t$, ignoring alignment consideration, is: $22$ bytes $14$ bytes $18$ bytes $10$ bytes
Consider the following C declaration:struct { short x[5]; union { float y; long z; } u; )t;Assume that the objects of the type short, float and long occupy $2$ bytes, $4$...
Kathleen
20.8k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
programming-in-c
easy
isro2015
union
+
–
38
votes
5
answers
92
GATE CSE 2005 | Question: 1, ISRO2017-55
What does the following C-statement declare? int (*f) (int * ); A function that takes an integer pointer as argument and returns an integer A function that takes an integer as argument and returns an integer pointer A pointer ... pointer as argument and returns an integer A function that takes an integer pointer as argument and returns a function pointer
What does the following C-statement declare?int (*f) (int * );A function that takes an integer pointer as argument and returns an integerA function that takes an integer ...
Kathleen
20.7k
views
Kathleen
asked
Sep 22, 2014
Programming in C
gatecse-2005
programming
programming-in-c
pointers
easy
isro2017
+
–
46
votes
4
answers
93
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
+
–
32
votes
7
answers
94
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.6k
views
Arjun
asked
Feb 7, 2019
DS
gatecse-2019
data-structures
binary-heap
2-marks
+
–
42
votes
9
answers
95
GATE CSE 2018 | Question: 2
Consider the following C program: #include<stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c", *((char*)q+1), *((char*)q+2)); return 0; } The output of this program is: 0, c 0, a+2 '0', 'a+2' '0', 'c'
Consider the following C program:#include<stdio.h struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c",...
gatecse
20.4k
views
gatecse
asked
Feb 14, 2018
Programming in C
gatecse-2018
programming-in-c
programming
structure
normal
1-mark
+
–
43
votes
2
answers
96
GATE CSE 2011 | Question: 22
What does the following fragment of C program print? char c[] = "GATE2011"; char *p = c; printf("%s", p + p[3] - p[1]); $\text{GATE2011}$ $\text{E2011}$ $2011$ $011$
What does the following fragment of C program print?char c[] = "GATE2011"; char *p = c; printf("%s", p + p[3] - p );$\text{GATE2011}$$\text{E2011}$$2011$$011$
go_editor
20.4k
views
go_editor
asked
Sep 29, 2014
Programming in C
gatecse-2011
programming
programming-in-c
normal
array
+
–
47
votes
11
answers
97
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
+
–
65
votes
4
answers
98
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.3k
views
Kathleen
asked
Sep 17, 2014
DS
gatecse-2003
data-structures
easy
isro2009
binary-search-tree
+
–
56
votes
7
answers
99
GATE CSE 2014 Set 3 | Question: 41
Consider the pseudocode given below. The function $DoSomething()$ takes as argument a pointer to the root of an arbitrary tree represented by the $leftMostChild-rightSibling$ representation. Each node of the tree is of type $treeNode$. typedef struct ... height of the tree. number of nodes without a right sibling in the tree. number of leaf nodes in the tree
Consider the pseudocode given below. The function $DoSomething()$ takes as argument a pointer to the root of an arbitrary tree represented by the $leftMostChild-rightSibl...
go_editor
19.8k
views
go_editor
asked
Sep 28, 2014
DS
gatecse-2014-set3
data-structures
tree
normal
+
–
3
votes
3
answers
100
UGC NET CSE | December 2014 | Part 2 | Question: 24
Consider an array $A\left[20, 10\right]$, assume $4$ words per memory cell and the base address of array $A$ is $100$. What is the address of $A\left[11, 5\right]$ ? Assume row major storage. $560$ $565$ $570$ $575$
Consider an array $A\left[20, 10\right]$, assume $4$ words per memory cell and the base address of array $A$ is $100$. What is the address of $A\left[11, 5\right]$ ? Assu...
makhdoom ghaya
19.6k
views
makhdoom ghaya
asked
Jul 21, 2016
Programming in C
ugcnetcse-dec2014-paper2
array
row-major-address-calculation
+
–
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