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 in C
49
votes
5
answers
41
GATE IT 2007 | Question: 27
The function f is defined as follows: int f (int n) { if (n <= 1) return 1; else if (n % 2 == 0) return f(n/2); else return f(3n - 1); } Assuming that arbitrarily large integers can be passed as a parameter to the function, consider the following ... values of $n \geq 1$. Which one of the following options is true of the above? i and iii i and iv ii and iii ii and iv
The function f is defined as follows:int f (int n) { if (n <= 1) return 1; else if (n % 2 == 0) return f(n/2); else return f(3n - 1); }Assuming that arbitrarily large int...
Ishrat Jahan
13.2k
views
Ishrat Jahan
asked
Oct 29, 2014
Programming in C
gateit-2007
programming
recursion
normal
+
–
62
votes
5
answers
42
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.6k
views
go_editor
asked
Sep 26, 2014
Programming in C
gatecse-2014-set1
programming
programming-in-c
easy
pointers
+
–
31
votes
5
answers
43
GATE CSE 1999 | Question: 2.5
Given the programming constructs assignment for loops where the loop parameter cannot be changed within the loop if-then-else forward go to arbitrary go to non-recursive procedure call recursive procedure/function call repeat loop, which constructs will you not include in a programming language ... $\text{(vi), (vii), (viii)}$ $\text{(iii), (vii), (viii)}$
Given the programming constructsassignmentfor loops where the loop parameter cannot be changed within the loopif-then-elseforward go toarbitrary go tonon-recursive proced...
Kathleen
12.7k
views
Kathleen
asked
Sep 23, 2014
Programming in C
gate1999
programming
normal
programming-constructs
+
–
38
votes
5
answers
44
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.9k
views
Kathleen
asked
Sep 22, 2014
Programming in C
gatecse-2005
programming
programming-in-c
pointers
easy
isro2017
+
–
26
votes
5
answers
45
GATE CSE 2004 | Question: 90
Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2. ... $P-3\quad Q-4 \quad R-1\quad S-2$ $P-3\quad Q-4\quad R-2\quad S-1$
Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2.$$\begin{array}{|ll|ll|}\hline \rlap{\textbf{Group 1}} & & \rlap{...
Kathleen
7.1k
views
Kathleen
asked
Sep 18, 2014
Programming in C
gatecse-2004
programming
normal
programming-paradigms
match-the-following
+
–
32
votes
5
answers
46
GATE CSE 2004 | Question: 32
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let $n = d_1\, d_2\, \ldots\, d_m$. int n, rev; rev = 0; while(n > 0) { rev = rev * 10 + n%10; n = n/10; } The loop invariant condition at the end ... $n=d_1\, d_2 \,\ldots\, d_m \qquad \mathbf{or} \qquad \text{rev} =d_m \,\ldots\, d_2\, d_1$
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer.Let $n = d_1\, d_2\, \ldots\, d_m$.int n, rev; rev = 0; while(...
Kathleen
12.3k
views
Kathleen
asked
Sep 18, 2014
Programming in C
gatecse-2004
programming
loop-invariants
normal
+
–
40
votes
5
answers
47
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.6k
views
Kathleen
asked
Sep 17, 2014
Programming in C
gatecse-2003
programming
programming-in-c
normal
pointers
+
–
40
votes
5
answers
48
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.4k
views
Kathleen
asked
Sep 17, 2014
Programming in C
gatecse-2003
compiler-design
normal
runtime-environment
parameter-passing
+
–
41
votes
5
answers
49
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.4k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
programming-in-c
easy
structure
+
–
28
votes
5
answers
50
GATE CSE 2008 | Question: 61
Choose the correct option to fill $?1$ and $?2$ so that the program below prints an input string in reverse order. Assume that the input string is terminated by a new line character. void reverse(void) { int c; if(?1) reverse(); ?2 } main() { printf("Enter text"); ... $?2$ is $putchar(c);$ $?1$ is $((c = getchar() ) != '\setminus n')$ $?2$ is $putchar(c);$
Choose the correct option to fill $?1$ and $?2$ so that the program below prints an input string in reverse order. Assume that the input string is terminated by a new lin...
Kathleen
8.2k
views
Kathleen
asked
Sep 12, 2014
Programming in C
gatecse-2008
programming
normal
programming-in-c
+
–
40
votes
5
answers
51
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
11.0k
views
gatecse
asked
Aug 5, 2014
Programming in C
gatecse-2012
programming
easy
programming-in-c
switch-case
+
–
13
votes
4
answers
52
GATE CSE 2019 | Question: 18
Consider the following C program : #include<stdio.h> int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n",x); return 0; } The value printed by the program is ______________.
Consider the following C program :#include<stdio.h int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n"...
Arjun
9.8k
views
Arjun
asked
Feb 7, 2019
Programming in C
gatecse-2019
programming-in-c
numerical-answers
identify-function
1-mark
+
–
2
votes
4
answers
53
C programming - Output ?
#include <stdio.h> int main() { unsigned char a = 5; a |= (1<<((sizeof(char)<<3)-1)); char b = a; printf("%d %d\n",b,a); printf("%u %u\n",b,a); } If the size of a char datatype is 1 Byte, then what will be the output? [Edited]
#include <stdio.h int main() { unsigned char a = 5; a |= (1<<((sizeof(char)<<3)-1)); char b = a; printf("%d %d\n",b,a); printf("%u %u\n",b,a); }If the size of a char data...
dd
2.1k
views
dd
asked
Apr 10, 2017
Programming in C
programming-in-c
+
–
3
votes
4
answers
54
C PROGRAMMING
kamboj
3.2k
views
kamboj
asked
Mar 20, 2017
2
votes
4
answers
55
recursion in c
output of program: void function(int); void main() { function(3); } void function(int num){ if(num>0) { function(--num); printf("%d",num); function(--num); } } will the argument num value be retained at all recursion levels?
output of program:void function(int); void main() { function(3); } void function(int num){ if(num>0) { function( num); printf("%d",num); function( num); } }will the argum...
gate_forum
1.5k
views
gate_forum
asked
Mar 16, 2017
Programming in C
programming-in-c
recursion
+
–
0
votes
4
answers
56
merge sort
harshit agarwal
1.2k
views
harshit agarwal
asked
Jan 15, 2017
Programming in C
merge-sort
algorithms
sorting
+
–
1
votes
4
answers
57
Virtual Gate Test Series: Programming & DS - Output Of The Program
What will be the output$?$ int main() { int varl = 35,*var2,*var3; var2 = &var1; //suppose the address of var1 is 1006 var3 = var2; *var2++ = *var3++; var1++; printf("var1 = %d var2 = %d var3 = %d ",var1,var2,var3); return 0; } 36 1010 1010 38 1006 1006 37 1006 1010 38 1010 1006
What will be the output$?$int main() { int varl = 35,*var2,*var3; var2 = &var1; //suppose the address of var1 is 1006 var3 = var2; *var2++ = *var3++; var1++; ...
Purple
906
views
Purple
asked
Jan 10, 2017
Programming in C
programming-in-c
output
virtual-gate-test-series
+
–
1
votes
4
answers
58
postfix to infix
The infix form of the following postfix form ‘P’ will be P: 3 , 5 , 7 , – , 10 , + , 4 , / , / (a) 3 / 5 – 7 + 10 / 4 (b) (((3 + 5) – (7 / 10 ))/ 4) (c) (3 / (((5 – 7) + 10) / 4)) (d) 3 + 5 – 7 / 10 / 4
The infix form of the following postfix form ‘P’will beP: 3 , 5 , 7 , – , 10 , + , 4 , / , /(a) 3 / 5 – 7 + 10 / 4 (b) (((3 + 5) – (7 / 10 ))/ 4)(c) (3 / (((5 �...
Sanjay Sharma
1.1k
views
Sanjay Sharma
asked
Dec 31, 2016
5
votes
4
answers
59
Time complexity and output
#include <stdio.h> #define N 3 int main() { int array[N] = {1,2,3}; int i,j; for ( i=1; i<(1<<N); i++) { for( j=0; j<N; j++) { if((1<<j)&i) { printf("%d", array[j]); } } printf("\n"); } return 0 ... $N = n \;\; , n \; \text{ is a positive integer }$ ? B. What is the output? C. What will be the complexity when $N$ is large.
#include <stdio.h #define N 3 int main() { int array[N] = {1,2,3}; int i,j; for ( i=1; i<(1<<N); i++) { for( j=0; j<N; j++) { if((1<<j)&i) { printf("%d", array[j]); } } p...
dd
1.9k
views
dd
asked
Dec 17, 2016
Programming in C
time-complexity
bitwise
programming-in-c
combinatory
summation
sub-set
binomial-theorem
+
–
3
votes
4
answers
60
Pointers
Samujjal Das
2.5k
views
Samujjal Das
asked
Nov 30, 2016
Programming in C
pointers
programming-in-c
+
–
Page:
« prev
1
2
3
4
5
6
7
8
...
206
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register