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
42
votes
4
answers
121
GATE CSE 2008 | Question: 62
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers $1, 2, 3, 4, 5, 6, 7$ in the given order. What will be the contents of the list after function completes execution? struct ... $1, 3, 2, 5, 4, 7, 6$ $2, 3, 4, 5, 6, 7, 1$
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing th...
Kathleen
19.0k
views
Kathleen
asked
Sep 12, 2014
DS
gatecse-2008
data-structures
linked-list
normal
+
–
41
votes
6
answers
122
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.4k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming-in-c
normal
numerical-answers
recursion
+
–
41
votes
4
answers
123
GATE CSE 2015 Set 3 | Question: 54
Consider the following C program: #include<stdio.h> int f1(void); int f2(void); int f3(void); int x=10; int main() { int x=1; x += f1() + f2 () + f3() + f2(); printf("%d", x); return 0; } int f1() { int x = 25; x++; return x;} int f2() { static int x = 50; x++; return x;} int f3() { x *= 10; return x;} The output of the program is ______.
Consider the following C program:#include<stdio.h int f1(void); int f2(void); int f3(void); int x=10; int main() { int x=1; x += f1() + f2 () + f3() + f2(); printf("%d", ...
go_editor
11.7k
views
go_editor
asked
Feb 16, 2015
Programming in C
gatecse-2015-set3
programming
programming-in-c
normal
numerical-answers
+
–
41
votes
4
answers
124
GATE CSE 2015 Set 2 | Question: 15
Consider the following function written in the C programming langauge : void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } } The output of the above function on input "$ABCD \ EFGH$" is $ABCD \ EFGH$ $ABCD$ $HGFE \ DCBA$ $DCBA$
Consider the following function written in the C programming langauge :void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } }The output of the above func...
go_editor
14.4k
views
go_editor
asked
Feb 12, 2015
Programming in C
gatecse-2015-set2
programming
programming-in-c
normal
recursion
+
–
41
votes
11
answers
125
GATE IT 2007 | Question: 30
Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are: $isEmpty (Q)$ - returns true if the queue is empty, false otherwise. $delete (Q)$ - deletes the element at the front of the queue ... the front of the queue $Q$ and inserts it at the rear keeping the other elements in the same order Empties the queue $Q$
Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:$isEmpty (Q)$ — returns true if the queue is empty...
Ishrat Jahan
16.1k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2007
data-structures
queue
normal
+
–
41
votes
2
answers
126
GATE CSE 2010 | Question: 36
The following C function takes a singly-linked list as input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. typedef struct node { int value; struct node *next; ... $q \rightarrow next = NULL; p \rightarrow next = head; head = p$;
The following C function takes a singly-linked list as input argument. It modifies the list by moving the last element to the front of the list and returns the modified l...
go_editor
10.8k
views
go_editor
asked
Sep 30, 2014
DS
gatecse-2010
data-structures
linked-list
normal
+
–
41
votes
4
answers
127
GATE CSE 2014 Set 2 | Question: 42
Consider the C function given below. int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else return 0; } Which one of the following is TRUE? The function returns $0$ for all ... . The function returns $0$ when $j = 50$. The function will exhaust the runtime stack or run into an infinite loop when $j = 50$.
Consider the C function given below.int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else return 0; }Which one of the fol...
go_editor
8.8k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
programming-in-c
+
–
41
votes
4
answers
128
GATE CSE 2013 | Question: 7
Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of $n$ nodes? $O(1)$ $O(\log n)$ $O(n)$ $O(n \log n)$
Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of $n$ nodes?$O(1)$$O(\log n)$...
Arjun
12.1k
views
Arjun
asked
Sep 23, 2014
DS
gatecse-2013
data-structures
easy
binary-search-tree
+
–
41
votes
5
answers
129
GATE CSE 2000 | Question: 1.11
The following C declarations: struct node { int i: float j; }; struct node *s[10]; define s to be: An array, each element of which is a pointer to a structure of type node A structure of $2$ ... $3$ fields: an integer, a float, and an array of $10$ elements An array, each element of which is a structure of type node
The following C declarations:struct node { int i: float j; }; struct node *s[10];define s to be:An array, each element of which is a pointer to a structure of type nodeA ...
Kathleen
19.1k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
programming-in-c
easy
structure
+
–
40
votes
3
answers
130
GATE CSE 2022 | Question: 18
Suppose a binary search tree with $1000$ distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with $0,$ the $3^{\text{rd}}$ largest element of the tree is stored at index ______________ .
Suppose a binary search tree with $1000$ distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assumin...
Arjun
14.8k
views
Arjun
asked
Feb 15, 2022
DS
gatecse-2022
numerical-answers
data-structures
binary-search-tree
1-mark
+
–
40
votes
3
answers
131
GATE CSE 2004 | Question: 43
Consider the following C program segment struct CellNode{ struct CellNode *leftChild int element; struct CellNode *rightChild; }; int Dosomething (struct CellNode *ptr) { int value = 0; if(ptr != NULL) { if (ptr -> leftChild != NULL) value = 1 + ... leaf nodes in the tree The number of nodes in the tree The number of internal nodes in the tree The height of the tree
Consider the following C program segmentstruct CellNode{ struct CellNode *leftChild int element; struct CellNode *rightChild; }; int Dosomething (struct CellNode *ptr) { ...
Kathleen
8.5k
views
Kathleen
asked
Sep 18, 2014
DS
gatecse-2004
data-structures
binary-tree
normal
+
–
40
votes
5
answers
132
GATE CSE 2003 | Question: 89
Consider the C program shown below: #include<stdio.h> #define print(x) printf("%d", x) int x; void Q(int z) { z+=x; print(z); } void P(int *y) { int x = *y + 2; Q(x); *y = x - 1; print(x); } main(void) { x = 5; P(&x); print(x); } The output of this program is: $12 \ 7 \ 6$ $22 \ 12 \ 11$ $14 \ 6 \ 6$ $7 \ 6 \ 6$
Consider the C program shown below:#include<stdio.h #define print(x) printf("%d", x) int x; void Q(int z) { z+=x; print(z); } void P(int *y) { int x = *y + 2; Q(x); *y = ...
Kathleen
12.3k
views
Kathleen
asked
Sep 17, 2014
Programming in C
gatecse-2003
programming
programming-in-c
normal
pointers
+
–
40
votes
5
answers
133
GATE CSE 2003 | Question: 73
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i=100, j=5; void P(x) { int i=10; print(x+10); i=200; j=20; print (x); } main() {P(i ... by need parameter passing mechanism, the values printed by the above program are: $115, 220$ $25, 220$ $25, 15$ $115, 105$
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions.global int i=100, j=5...
Kathleen
9.1k
views
Kathleen
asked
Sep 17, 2014
Programming in C
gatecse-2003
compiler-design
normal
runtime-environment
parameter-passing
+
–
40
votes
1
answer
134
GATE CSE 2002 | Question: 1.17
In the C language: At most one activation record exists between the current activation record and the activation record for the main The number of activation records between the current activation record and the activation records from the main ... record for the recursive function to be saved in a different stack before the recursive function can be called.
In the C language:At most one activation record exists between the current activation record and the activation record for the mainThe number of activation records betwee...
Kathleen
10.1k
views
Kathleen
asked
Sep 15, 2014
Programming in C
gatecse-2002
programming
programming-in-c
easy
descriptive
+
–
40
votes
5
answers
135
GATE CSE 2012 | Question: 3
What will be the output of the following C program segment? char inChar = 'A'; switch ( inChar ) { case 'A' : printf ("Choice A \ n"); case 'B' : case 'C' : printf ("Choice B"); case ... : printf ("No Choice"); } No Choice Choice A Choice A Choice B No Choice Program gives no output as it is erroneous
What will be the output of the following C program segment?char inChar = 'A'; switch ( inChar ) { case 'A' : printf ("Choice A \ n"); case 'B' : case 'C' : printf ("Choic...
gatecse
10.8k
views
gatecse
asked
Aug 5, 2014
Programming in C
gatecse-2012
programming
easy
programming-in-c
switch-case
+
–
39
votes
2
answers
136
TIFR CSE 2013 | Part B | Question: 13
Given a binary tree of the following form and having $n$ nodes, the height of the tree is $\Theta \left(\log n\right)$ $\Theta \left(n\right)$ $\Theta \left(\sqrt{n}\right)$ $\Theta \left(n / \log n\right)$ None of the above.
Given a binary tree of the following form and having $n$ nodes, the height of the tree is$\Theta \left(\log n\right)$$\Theta \left(n\right)$$\Theta \left(\sqrt{n}\right)$...
makhdoom ghaya
3.4k
views
makhdoom ghaya
asked
Nov 7, 2015
DS
tifr2013
binary-tree
data-structures
+
–
39
votes
6
answers
137
GATE CSE 1996 | Question: 1.13
An advantage of chained hash table (external hashing) over the open addressing scheme is Worst case complexity of search operations is less Space used is less Deletion is easier None of the above
An advantage of chained hash table (external hashing) over the open addressing scheme isWorst case complexity of search operations is lessSpace used is lessDeletion is ea...
Kathleen
13.6k
views
Kathleen
asked
Oct 9, 2014
DS
gate1996
data-structures
hashing
normal
+
–
39
votes
5
answers
138
GATE CSE 2009 | Question: 37,ISRO-DEC2017-55
What is the maximum height of any AVL-tree with $7$ nodes? Assume that the height of a tree with a single node is $0$. $2$ $3$ $4$ $5$
What is the maximum height of any AVL-tree with $7$ nodes? Assume that the height of a tree with a single node is $0$.$2$$3$$4$$5$
Kathleen
43.3k
views
Kathleen
asked
Sep 22, 2014
DS
gatecse-2009
data-structures
binary-search-tree
normal
isrodec2017
avl-tree
+
–
39
votes
4
answers
139
GATE CSE 2002 | Question: 2.8
Consider the following declaration of a two-dimensional array in C: char $a[100][100]$; Assuming that the main memory is byte-addressable and that the array is stored starting from memory address $0$, the address of $a [40][50]$ is: $4040$ $4050$ $5040$ $5050$
Consider the following declaration of a two-dimensional array in C:char $a[100][100]$;Assuming that the main memory is byte-addressable and that the array is stored start...
Kathleen
27.7k
views
Kathleen
asked
Sep 15, 2014
Programming in C
gatecse-2002
programming-in-c
programming
easy
+
–
38
votes
11
answers
140
GATE CSE 2021 Set 2 | Question: 10
Consider the following $\text{ANSI C}$ program. #include <stdio.h> int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) { for (j=0; j<5; j++) { arr[i][j] = 10 * i + j; } } printf(“%d”, *(arr[1]+9)); return 0; } What is the output of the above program? $14$ $20$ $24$ $30$
Consider the following $\text{ANSI C}$ program.#include <stdio.h int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) { for (j=0; j<5; j++) { arr[i...
Arjun
29.9k
views
Arjun
asked
Feb 18, 2021
Programming in C
gatecse-2021-set2
programming-in-c
array
output
1-mark
+
–
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