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
Previous GATE Questions in Programming in C
4
votes
2
answers
1
GATE CSE 2024 | Set 2 | Question: 3
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left. #include <stdio.h> int g( int p) { printf("%d", p); return p; } int h(i nt q) { printf("%d", q) ... one of the following options is the CORRECT output of the above $\text{C}$ program? $20101020$ $10202010$ $20102010$ $10201020$
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left.#include <stdio.h int g( int p) { printf("%d", p); return p; }...
Arjun
4.1k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
functions
+
–
5
votes
2
answers
2
GATE CSE 2024 | Set 2 | Question: 23
Consider the following $\mathrm{C}$ function definition. int f X(char * a) { char * b = a; while (*b) b ++; return b - a; } Which of the following statements is/are TRUE? The function call $\text{f X("a b c d''}$) will ... ${ }^{*} \mathrm{C}=$ "abcd" in main (), the function call $\mathrm{fX}(\mathrm{c})$ will always return a value
Consider the following $\mathrm{C}$ function definition.int f X(char * a) { char * b = a; while (*b) b ++; return b - a; }Which of the following statements is/ar...
Arjun
2.6k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
multiple-selects
output
+
–
3
votes
3
answers
3
GATE CSE 2024 | Set 2 | Question: 26
What is the output of the following $\text{C}$ program? #include <stdio.h> int main() { double a[2]=20.0,25.0,* p,* q; p=a ; q=p+1 ; printf("%d,%d", (int) (q-p),( int)(* q- * p)); return 0; $4,8$ $1,5$ $8,5$ $1,8$
What is the output of the following $\text{C}$ program?#include <stdio.h int main() { double a =20.0,25.0,* p,* q; p=a ; q=p+1 ; printf("%d,%d", (int) (q-...
Arjun
3.2k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
pointers
+
–
3
votes
3
answers
4
GATE CSE 2024 | Set 1 | Question: 8
Consider the following $\mathrm{C}$ program: #include <stdio.h> int main() { int a=6; int b = 0; while (a<10) { a = a / 12+1 ; a += b ;} printf ("%d", a); return 0 ; } Which one of the following ... The program prints $9$ as output The program prints $10$ as output The program gets stuck in an infinite loop The program prints $6$ as output
Consider the following $\mathrm{C}$ program:#include <stdio.h int main() { int a=6; int b = 0; while (a<10) { a = a / 12+1 ; a += b ;} printf ("%d", a); return 0 ; }Whi...
Arjun
6.2k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
programming
programming-in-c
output
+
–
1
votes
3
answers
5
GATE CSE 2024 | Set 1 | Question: 9
Consider the following $\mathrm{C}$ program: #include <stdio.h> void fX (); int main(){ fX(); return 0 }; void fX () { char a; if ((a=g e t c h a r()) ! = '\n') fX(); if (a ! ... program will not terminate The program will terminate with no output The program will terminate with $4321$ as output The program will terminate with $1234$ as output
Consider the following $\mathrm{C}$ program:#include <stdio.h void fX (); int main(){ fX(); return 0 };void fX () { char a; if ((a=g e t c h a r()) ! = '\n') ...
Arjun
3.2k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
programming
programming-in-c
output
+
–
2
votes
2
answers
6
GATE CSE 2024 | Set 1 | Question: 38
Consider the following $\mathrm{C}$ ... the return value is less than $2^{10}$ If the inputs are $x=10, y=20$, then the return value is greater than $2^{20}$
Consider the following $\mathrm{C}$ function definition.int f (int x, int y){ for (int i=0 ; i<y ; i++ ) { x= x + x + y; } return x; }Which of the following stateme...
Arjun
2.4k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
multiple-selects
programming
programming-in-c
+
–
13
votes
4
answers
7
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
+
–
102
votes
9
answers
8
GATE CSE 2017 Set 1 | Question: 53
Consider the following C program. #include<stdio.h> #include<string.h> void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t); printf("%d\n", len); } ... in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
Consider the following C program.#include<stdio.h #include<string.h void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) c) ? strlen...
srestha
25.3k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
68
votes
5
answers
9
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.6k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
54
votes
7
answers
10
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
17.2k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
algorithms
numerical-answers
identify-function
+
–
36
votes
6
answers
11
GATE CSE 2017 Set 2 | Question: 37
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int. while (r >= y) { r=r-y; q=q+1; } Which of the following conditions on the variables $x, y, q$ and $r$ ... $(q==0) \ \&\& \ (y>0)$
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int.while (r >...
Arjun
14.7k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
loop-invariants
+
–
70
votes
13
answers
12
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
28.5k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
array
pointers
+
–
104
votes
7
answers
13
GATE CSE 2017 Set 1 | Question: 36
Consider the C functions foo and bar given below: int foo(int val) { int x=0; while(val > 0) { x = x + foo(val--); } return val; } int bar(int val) { int x = 0; while(val > 0) { x ... in: Return of $6$ and $6$ respectively. Infinite loop and abnormal termination respectively. Abnormal termination and infinite loop respectively. Both terminating abnormally.
Consider the C functions foo and bar given below:int foo(int val) { int x=0; while(val 0) { x = x + foo(val ); } return val; }int bar(int val) { int x = 0; while(val 0)...
Arjun
25.6k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
normal
recursion
+
–
47
votes
11
answers
14
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.6k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
normal
tricky
recursion
+
–
88
votes
7
answers
15
GATE CSE 2017 Set 1 | Question: 13
Consider the following C code: #include<stdio.h> int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return; x = assignval (x,0); ... and not as shown. compiles successfully but execution may result in dangling pointer. compiles successfully but execution may result in memory leak.
Consider the following C code:#include<stdio.h int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return...
Arjun
35.6k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
pointers
+
–
25
votes
7
answers
16
GATE CSE 2017 Set 2 | Question: 54
Consider the following C program. #include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n--; --n1; n-=n1; printf(“%d”, n); return 0; } The output of the program is ______
Consider the following C program.#include<stdio.h int main () { int m=10; int n, n1; n=++m; n1=m++; n ; n1; n-=n1; printf(“%d”, n); return 0; }The output of the prog...
Madhav
12.1k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
easy
+
–
30
votes
11
answers
17
GATE CSE 2017 Set 2 | Question: 14
Consider the following function implemented in C: void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); } The output of invoking $printxy(1,1)$ is: $0, 0$ $0, 1$ $1, 0$ $1, 1$
Consider the following function implemented in C:void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); }The output of invoking $...
Madhav
9.8k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
identify-function
pointers
+
–
26
votes
3
answers
18
GATE CSE 2017 Set 2 | Question: 2
Match the following: ... ; R-i; S-iii P-ii; Q-i; R-iv; S-iii P-ii; Q-iv; R-iii; S-i P-iii; Q-iv; R-i; S-ii
Match the following:$$\begin{array}{|ll|ll|}\hline P. & \text{static char var ;} & \text{i.} & \text{Sequence of memory locations to store addresses} \\\hline Q. & \text...
khushtak
5.9k
views
khushtak
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
programming-in-c
match-the-following
+
–
1
votes
0
answers
19
GATE CSE 1988 | Question: 8iv
Consider the following Ada program: Procedure P is BAD-FORMAT: exception Procedure Q is begin ... if S/='b' then raise BAD-FORMAT end if; ... end Q; Procedure R is begin Q; exception when BAD-Format => ... handler body 1 end R; begin ... when BAD-FORMAT => ... handler body 2 end P; Under what conditions are the two handler bodies $1$ and $2$ executed?
Consider the following Ada program:Procedure P is BAD-FORMAT: exception Procedure Q is begin ... if S/='b' then raise BAD-FORMAT end if; ... end Q; Procedure R is begin Q...
go_editor
506
views
go_editor
asked
Dec 19, 2016
Programming in C
gate1988
normal
descriptive
programming
ada
out-of-gate-syllabus
+
–
0
votes
1
answer
20
GATE CSE 1988 | Question: 8iii
Write a LISP function to compute the product of all the numbers in a list. Assume that the list contains only number.
Write a LISP function to compute the product of all the numbers in a list. Assume that the list contains only number.
go_editor
495
views
go_editor
asked
Dec 19, 2016
Programming in C
gate1988
descriptive
programming
lisp
out-of-gate-syllabus
+
–
To see more, click for the
full list of questions
or
popular tags
.
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register