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 and DS
5
votes
1
answer
1861
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
535
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
1862
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
334
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
1863
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
449
views
viral8702
asked
Apr 29, 2022
Programming in C
data-structures
array
+
–
8
votes
1
answer
1864
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
601
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
1865
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
336
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
1866
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
1
answer
1867
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
319
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
1868
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
228
views
ykrishnay
asked
Apr 23, 2022
Programming in C
algorithms
programming-in-c
programming
number-system
digital-logic
+
–
5
votes
1
answer
1869
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
+
–
1
votes
1
answer
1870
time complexity
what is T.C. of this code: for(i=1;i<=n;i++) for(j=1;j<=n;j=j+i) x=x+1;
what is T.C. of this code: for(i=1;i<=n;i++) for(j=1;j<=n;j=j+i) x=x+1;
jugnu1337
435
views
jugnu1337
asked
Apr 20, 2022
DS
time-complexity
+
–
9
votes
1
answer
1871
GO Classes Test Series 2024 | Programming | Test 1 | Question: 6
Consider the $k$ bit binary pattern on 2's complement system. $\text{T}_{\max}$ and $\text{T}_{\min}$ are maximum and minimum signed numbers we can represent using $k$ bits. $\text{U}_{\max}$ and $\text{U}_{\min}$ are maximum and minimum ... $\text{U}_{\min} = !(1>>31)$ $\text{U}_{\max} = \;\sim(1>>31)$
Consider the $k$ bit binary pattern on 2’s complement system.$\text{T}_{\max}$ and $\text{T}_{\min}$ are maximum and minimum signed numbers we can represent using $k$ b...
GO Classes
591
views
GO Classes
asked
Apr 18, 2022
Programming in C
goclasses2024-programming-1-weekly-quiz
goclasses
programming
number-representation
multiple-selects
1-mark
+
–
8
votes
1
answer
1872
GO Classes Test Series 2024 | Programming | Test 1 | Question: 8
What is the output of the following code? Assume that int is $32$ bits, short is $16$ bits, and the representation is two's complement. unsigned int x = 0xDEADBEEF; unsigned short y = 0xFFFF; signed int z = -1; ... Hello"); if (x > z) printf("World"); Prints nothing Prints Hello Prints World Prints HelloWorld
What is the output of the following code? Assume that int is $32$ bits, short is $16$ bits, and the representation is two’s complement.unsigned int x = 0xDEADBEEF; unsi...
GO Classes
525
views
GO Classes
asked
Apr 18, 2022
Programming in C
goclasses2024-programming-1-weekly-quiz
goclasses
programming
programming-in-c
output
2-marks
+
–
9
votes
1
answer
1873
GO Classes Test Series 2024 | Programming | Test 1 | Question: 22
Consider the following C code. Where $x$ and $y$ are unknown integers and have been initialized to values greater than $1.$ int i=1, j=0; while (i<y) { j = j+i; i = i+1; if(i==x) break; } Which of the following statement(s) about the variables $i$ and ... then $i = y-1$ $(j=y(y+1)/2 \wedge (i=y)) \vee ((j=x(x+1)/2)\wedge (i = x))$
Consider the following C code. Where $x$ and $y$ are unknown integers and have been initialized to values greater than $1.$int i=1, j=0; while (i<y) { j = j+i; i = i+1; i...
GO Classes
462
views
GO Classes
asked
Apr 18, 2022
Programming in C
goclasses2024-programming-1-weekly-quiz
goclasses
programming
programming-in-c
multiple-selects
2-marks
+
–
9
votes
1
answer
1874
GO Classes Test Series 2024 | Programming | Test 1 | Question: 25
What will be the output of the following C program? #include<stdio.h> void main() { int a =0; int b = (a-- ? a++: a ? a++ : a-- ); printf("%d", b); } $0$ $-1$ $-2$ $2$
What will be the output of the following C program?#include<stdio.h void main() { int a =0; int b = (a ? a++: a ? a++ : a ); printf("%d", b); }$0$$-1$$-2$$2$
GO Classes
1.0k
views
GO Classes
asked
Apr 18, 2022
Programming in C
goclasses2024-programming-1-weekly-quiz
goclasses
programming
programming-in-c
output
1-mark
+
–
1
votes
1
answer
1875
Applied Root Test Series
Let C(X) be the number of leaves in a binary tree rooted at T. Assume that IsLeaf(T) returns I if T is a leaf. Which of the following observations leads to a recursive implementation? C(T)=C(T.Left) +C(T.Right) C(T):C(T.Left)+C(T.Right)+1 C(T)=C(T.Left]+C(T.right)+Isleaf(T)
Let C(X) be the number of leaves in a binary tree rooted at T. Assume that IsLeaf(T) returns I if T is a leaf. Which of the following observations leads to a recursive im...
Nitesh_Yadav
297
views
Nitesh_Yadav
asked
Apr 12, 2022
Programming in C
recursion
programming-in-c
+
–
5
votes
1
answer
1876
GO Classes 2023 | Weekly Quiz 6 | Question: 2
What will be the output of the following program? #include<stdio.h> main() { int a[2][3][4]; printf("%d", a[1][0]-a[0][2]); }
What will be the output of the following program?#include<stdio.h main() { int a [3][4]; printf("%d", a [0]-a[0] ); }
GO Classes
531
views
GO Classes
asked
Apr 6, 2022
Programming in C
goclasses_wq6
goclasses
programming
programming-in-c
array
output
numerical-answers
2-marks
+
–
4
votes
1
answer
1877
GO Classes 2023 | Weekly Quiz 6 | Question: 9
What will be the output of the following program? #include<stdio.h> void swap(char **s1, char **s2){ char *tmp; tmp=*s1; *s1=*s2; *s2=tmp; } int main() { char *str[3]= {"orange", "apple", "pear"} ... ;%s %s %s", strs[0], strs[1], strs[2]); } pear apple orange apple pear orange orange apple pear apple orange pea
What will be the output of the following program?#include<stdio.h void swap(char s1, char s2){ char *tmp; tmp=*s1; *s1=*s2; *s2=tmp; } int main() { char *str[3]= {"oran...
GO Classes
547
views
GO Classes
asked
Apr 6, 2022
Programming in C
goclasses_wq6
goclasses
programming
programming-in-c
array
array-of-pointers
2-marks
+
–
3
votes
1
answer
1878
GO Classes 2023 | Weekly Quiz 6 | Question: 12
#include<stdio.h> #include<string.h> char upstr[50]; void putStar (int n,char str[]){ upstr[n] = str[n]; if(n == strlen(str)) return; else upstr[n+1] = '*'; putStar(n+1,str); } int main() { char str[] = "hello"; ... %s", upstr); } What will be the output of the given program? h*e*l*l*o h*e*l*l*o* h*e*l*l* hello
#include<stdio.h #include<string.h char upstr[50]; void putStar (int n,char str[]){ upstr[n] = str[n]; if(n == strlen(str)) return; else upstr[n+1] = '*'; putStar(n+1,str...
GO Classes
349
views
GO Classes
asked
Apr 6, 2022
Programming in C
goclasses_wq6
goclasses
programming
programming-in-c
array
2-marks
+
–
3
votes
1
answer
1879
GO Classes 2023 | Weekly Quiz 6 | Question: 13
#include<stdio.h> int bar(int data[], int i, int a, int x) { if (x<0) return 0; x--; int b = a + data[i]; if(data[i] >0) return bar(data, i+1, b, x); if(data[i] == 0 || i ==x-1) return a; return -a; } int main() ... ;data+1)-data; printf("%d", bar(data, 0, 0, x) ); } What will be the output of a given program? $6$ $-6$ $0$ $5$
#include<stdio.h int bar(int data[], int i, int a, int x) { if (x<0) return 0; x ; int b = a + data[i]; if(data[i] >0) return bar(data, i+1, b, x); if(data[i] == 0 || i =...
GO Classes
505
views
GO Classes
asked
Apr 6, 2022
Programming in C
goclasses_wq6
goclasses
programming
programming-in-c
array
2-marks
+
–
0
votes
1
answer
1880
What will be the output and Why?
#include<stdio.h> int main() { char num = '\011'; printf("%d",num); return 0; }
#include<stdio.h int main() { char num = '\011'; printf("%d",num); return 0; }
Anirudh Kaushal
262
views
Anirudh Kaushal
asked
Apr 4, 2022
Programming in C
programming-in-c
+
–
Page:
« prev
1
...
89
90
91
92
93
94
95
96
97
98
99
...
309
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register