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
Recent questions in Programming and DS
1
votes
0
answers
301
Self doubt - printing null character from a character array.
We use character array to declare string in C. So, if I declare an array like character ch[ ] = {‘a’,’k’,’a’,’/o’}; and try printing ch[3] like : printf(“%C”,ch[3]); what will be the output ?
We use character array to declare string in C. So, if I declare an array likecharacter ch[ ] = {‘a’,’k’,’a’,’/o’};and try printing ch[3] like :printf(“%...
aakash pandey
281
views
aakash pandey
asked
Apr 30, 2022
Programming in C
programming-in-c
strings
+
–
3
votes
1
answer
302
GO Classes Test Series 2024 | Programming | Test 3 | Question: 15
If the $32$-bit number given below is stored in little-endian at address $1000,$ what is the value of the byte at address $1002?$ Answer in decimal. $0001\; 0010 \;0011\; 0100\; 0101\; 0110\; 0111\; 1000$ This number is the same as $12345678$ in hexadecimal.
If the $32$-bit number given below is stored in little-endian at address $1000,$ what is the value of the byte at address $1002?$ Answer in decimal.$$0001\; 0010 \;0011\;...
GO Classes
419
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
numerical-answers
goclasses
programming
programming-in-c
number-representation
2-marks
+
–
2
votes
1
answer
303
GO Classes Test Series 2024 | Programming | Test 3 | Question: 16
What will be printed by the following program? #include<stdio.h> int func(int n, int * fg) { int t, f; if (n <= 1) { *fg = 1; return 1; } t = func(n - 1, fg); f = t + *fg; *fg = t; return f; } int main() { int x = 15; printf("%d\n", func(5, &x)); }
What will be printed by the following program?#include<stdio.h int func(int n, int * fg) { int t, f; if (n <= 1) { *fg = 1; return 1; } t = func(n - 1, fg); f = t + *fg; ...
GO Classes
265
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
numerical-answers
goclasses
programming
programming-in-c
functions
2-marks
+
–
3
votes
1
answer
304
GO Classes Test Series 2024 | Programming | Test 3 | Question: 19
#include<stdio.h> int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); printf("%d", a); } $2$ $3$ $4$ Run time error since we can not pass the address of local variable c in the function test.
#include<stdio.h int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); p...
GO Classes
363
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
functions
pointers
parameter-passing
recursion
2-marks
+
–
3
votes
1
answer
305
GO Classes Test Series 2024 | Programming | Test 3 | Question: 21
Consider the following C code where main shows the intended use of the functions relating to struct foo. struct foo { int x; int y; int * p; }; struct foo* make_foo() { struct foo *foo = malloc(sizeof( ... program has a dangling pointer Given program may result in run time error Given program will result in a compile-time error
Consider the following C code where main shows the intended use of the functions relating to struct foo.struct foo { int x; int y; int * p; }; struct foo* make_foo() { st...
GO Classes
522
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
structure
pointers
multiple-selects
2-marks
+
–
3
votes
1
answer
306
GO Classes Test Series 2024 | Programming | Test 3 | Question: 22
What does the following program print? #include<stdio.h> #include<string.h> struct MdbRec { char name[16]; char msg[24]; }; int main() { struct MdbRec m[1]; strcpy(m[0].name, "dude"); strcpy(m[0].msg, " ... printf("%d", m->msg - (char *)m ); } Prints nothing Prints $17$ Prints $24$ Prints $16$
What does the following program print?#include<stdio.h #include<string.h struct MdbRec { char name[16]; char msg[24]; }; int main() { struct MdbRec m ; strcpy(m[0].name, ...
GO Classes
533
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
structure
array
multiple-selects
2-marks
+
–
3
votes
2
answers
307
GO Classes Test Series 2024 | Programming | Test 3 | Question: 23
What will be the output of the following lines of code? int i = 0; int j = 0; char *s = "ceded"; while (s[i] != '\0') { j = j + s[i] - 'b'; i = i + 1; } printf("%d %d\n", i, j); $5\; 11$ $4\; 16$ $5\; 16$ $4 \;11$
What will be the output of the following lines of code?int i = 0; int j = 0; char *s = "ceded"; while (s[i] != '\0') { j = j + s[i] - 'b'; i = i + 1; } printf("%d %d\n", ...
GO Classes
269
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
loop
output
2-marks
+
–
3
votes
1
answer
308
GO Classes Test Series 2024 | Programming | Test 3 | Question: 26
What will be the output of the following C program? #include<stdio.h> int main() { static int p[] = {1, 2, 3, 0, 5, 6}; static int *q[] = {p+2, p+1, p, p+3, p+4, p+5}; static int **r[] = {q+4, q+5, q+1, q, q+2, q+3}; int ***pt; pt = r + 2; printf("%d", ***(pt+3)-**(q+1)); }
What will be the output of the following C program?#include<stdio.h int main() { static int p[] = {1, 2, 3, 0, 5, 6}; static int *q[] = {p+2, p+1, p, p+3, p+4, p+5}; stat...
GO Classes
424
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
numerical-answers
goclasses
programming
programming-in-c
array
pointers
array-of-pointers
2-marks
+
–
5
votes
1
answer
309
GO Classes Test Series 2024 | Programming | Test 3 | Question: 29
Mark all options which are likely to create problems with memory, i.e., run time error or have a memory leak. Assume malloc is always successful, and sizes are as follows - sizeof(int *) = 8 bytes sizeof(double) = 8 bytes sizeof(char) = 1 ... 4 int *p = malloc(sizeof(char)); *p = 0; Program $1$ Program $2$ Program $3$ Program $4$
Mark all options which are likely to create problems with memory, i.e., run time error or have a memory leak. Assume malloc is always successful, and sizes are as follows...
GO Classes
529
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
pointers
multiple-selects
2-marks
+
–
4
votes
1
answer
310
GO Classes Test Series 2024 | Programming | Test 3 | Question: 30
What will be the output of the following program? It is given that $\textsf{sizeof(int) = 4}$ and $\textsf{sizeof(int *) = 8.}$ #include<stdio.h> main(){ void** p = 1000; int* q = ((int*)(p + 1)) - 1; printf("%u", q); } $1000$ $1008$ $1004$ Error, since $p+1$ is not allowed as $p$ is declared as void.
What will be the output of the following program?It is given that $\textsf{sizeof(int) = 4}$ and $\textsf{sizeof(int *) = 8.}$#include<stdio.h main(){ void p = 1000; int...
GO Classes
332
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
pointers
2-marks
+
–
0
votes
1
answer
311
A frame buffer array is addressed in row major order for a monitor with pixel locations starting from (0,0) and ending with (100,100). What is address of the pixel(6,10)? Assume one bit storage per pixel and starting pixel location is at 0. 1) 1016 2)1006 3) 610 4)616
A frame buffer array is addressed in row major order for a monitor with pixel locations starting from (0,0) and ending with (100,100). What is address of the pixel(6,10)?...
viral8702
447
views
viral8702
asked
Apr 29, 2022
Programming in C
data-structures
array
+
–
0
votes
0
answers
312
C programming - code
what is the ouput of this code ? main() { int x = 10; int y = (++x) + (--x); printf(“%d”,y); } and i am confuse about this code specifically about this expression int y = (++x) + (--x); so if this expression is wrong so what the wrong about this expression and topic related to “Precedence and associativity”
what is the ouput of this code ?main(){int x = 10;int y = (++x) + ( x);printf(“%d”,y);} and i am confuse about this code specifically about this expression int y = (+...
ykrishnay
270
views
ykrishnay
asked
Apr 27, 2022
Programming in C
programming-in-c
programming
+
–
0
votes
0
answers
313
write down a program to implement n queen problem using constraint programming approch when n=4
cse
cse
geraad
99
views
geraad
asked
Apr 26, 2022
8
votes
1
answer
314
GO Classes Test Series 2024 | Programming | Test 2 | Question: 3
Consider two files given below. //file1.c #include<stdio.h> main () { extern int i; printf("file1"); } //file2.c #include<stdio.h> main () { int i =1; printf("file2"); } We compile ... compiled independently but can not be linked together file$1$.c can be compiled and linked independently of file$2$.c.
Consider two files given below.//file1.c #include<stdio.h main () { extern int i; printf("file1"); } //file2.c #include<stdio.h main () { int i =1; printf("file2"); }We c...
GO Classes
596
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
storage-classes-in-c
multiple-selects
1-mark
+
–
5
votes
1
answer
315
GO Classes Test Series 2024 | Programming | Test 2 | Question: 9
What will be the output of running file main.c? write.c *********************** extern int count; void write_extern() { count +=2; } main.c *********************** #include "write.c" #include<stdio.h> int count = 5; main() { write_extern(); write_extern(); printf("%d", count); } $0$ $5$ $9$ None of these
What will be the output of running file main.c?write.c * extern int count; void write_extern() { count +=2; }main.c * #include "write.c" #include<st...
GO Classes
335
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
storage-classes-in-c
output
1-mark
+
–
3
votes
1
answer
316
GO Classes Test Series 2024 | Programming | Test 2 | Question: 20
Consider the following two .c files, which both include the same .h file: When compiled, linked, and executed, the following output results: $x = 1 \; y = 2\; z = 3\; w = 4\; v = 5$ Assuming that this program compiled and linked ... Line$(6)$ - empty Line$(7)$ - empty Line$(8)$ - static Line$(9)$ - empty Line$(10)$ - static
Consider the following two .c files, which both include the same .h file:When compiled, linked, and executed, the following output results:$x = 1 \; y = 2\; z = 3\; w = 4...
GO Classes
410
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
storage-classes-in-c
2-marks
+
–
6
votes
3
answers
317
GO Classes Test Series 2024 | Programming | Test 2 | Question: 21
What will be the output of the following program? #include<stdio.h> int rec(int x, int y) { static int count = 0; if (x == 0) return count; count++; if (x > y) rec(x - y, y); else rec(x, y - x); return count; } main() { int i = 10, j = 2, n; n = rec(i, j); printf("%d", n); } $4$ $5$ $6$ Infinite loop
What will be the output of the following program?#include<stdio.h int rec(int x, int y) { static int count = 0; if (x == 0) return count; count++; if (x y) rec(x - y, y)...
GO Classes
379
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
recursion
output
2-marks
+
–
6
votes
1
answer
318
GO Classes Test Series 2024 | Programming | Test 2 | Question: 23
What will be the output of the program below- int i = 1; void my_extern1(void); void my_extern2(void); int main() { int count = 0; while (i++<5) { static int i = 3; i++; count +=i; my_extern1(); } printf("%d", ... (); } void my_extern2(){ extern int i; if (i++ < 3) my_extern1(); } Infinite recursion $9$ $4$ $5$
What will be the output of the program below-int i = 1; void my_extern1(void); void my_extern2(void); int main() { int count = 0; while (i++<5) { static int i = 3; i++; c...
GO Classes
318
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
recursion
output
2-marks
+
–
0
votes
1
answer
319
How to find a range of float,double,long in c programming?
How to find a range of float,double,long in c programming? just like we find the range in case of int (signed,unsigned),char (signed ,unsigned) in c programming language ? like integer unsigned range is 0 to 65535 and so on for other data types ? Thank you ahead
How to find a range of float,double,long in c programming? just like we find the range in case of int (signed,unsigned),char (signed ,unsigned) in c programming language ...
ykrishnay
227
views
ykrishnay
asked
Apr 23, 2022
Programming in C
algorithms
programming-in-c
programming
number-system
digital-logic
+
–
5
votes
1
answer
320
GO Classes 2023 | Weekly Quiz 8 | Question: 2
Consider below four program fragments. Which of the program(s) is/are likely to produce run time error or memory leak. Assume malloc is always successful, and sizes are as follows - sizeof(int *) = 8 bytes sizeof(double) = 8 bytes sizeof(char) = 1 byte sizeof( ... ] = %d\n", a[0], a[1]); return 0; } Program $1$ Program $2$ Program $3$ Program $4$
Consider below four program fragments. Which of the program(s) is/are likely to produce run time error or memory leak. Assume malloc is always successful, and sizes are a...
GO Classes
1.1k
views
GO Classes
asked
Apr 21, 2022
Programming in C
goclasses_wq8
goclasses
programming
programming-in-c
multiple-selects
2-marks
+
–
Page:
« prev
1
...
11
12
13
14
15
16
17
18
19
20
21
...
309
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register