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
2
votes
1
answer
1841
TIFR CSE 2022 | Part B | Question: 5
There is an unsorted list of $n$ integers. You are given $3$ distinct integers and you have to check if all $3$ integers are present in the list or not. The only operation that you are allowed to perform is a comparison. Let $A$ be an algorithm for this task that performs the least number ... $c=3 n$ $c=2 n+5$ $c \geq 3 n-1$ $c \leq n$ $c \leq 2 n+3 $
There is an unsorted list of $n$ integers. You are given $3$ distinct integers and you have to check if all $3$ integers are present in the list or not. The only operatio...
admin
643
views
admin
asked
Sep 1, 2022
DS
tifr2022
data-structures
linked-list
+
–
2
votes
1
answer
1842
Algorithm which uses Max heap to find i smallest elements
Can anyone please explain how to find “ i “ smallest elements from an array whose elements are distinct Please use max heap to explain the working input : n distinct elements output : i smallest elements
Can anyone please explain how to find “ i “ smallest elements from an array whose elements are distinctPlease use max heap to explain the working input : n distinct e...
Thor-o-s
428
views
Thor-o-s
asked
Sep 1, 2022
DS
algorithms
binary-heap
data-structures
+
–
0
votes
1
answer
1843
Trees
In GATE if questions just mention a tree then should we assume it to be a directed or undirected tree? Also, if we are having an undirected tree then does the child node contains a pointer to the parent node?
In GATE if questions just mention a tree then should we assume it to be a directed or undirected tree?Also, if we are having an undirected tree then does the child node c...
Chaitanya Kale
451
views
Chaitanya Kale
asked
Aug 31, 2022
DS
tree
+
–
3
votes
1
answer
1844
Data Structures,Algorithms&Applications In c++ page-249 Q-34
In an n x n C-matrix, all terms other than those in row 1, row n, and column 1 are zero. A C-matrix has at most 3n-2 nonzero terms. A C-matrix may be compactly stored in one-dimensional array by first storing row 1, then row n, and then the remaining column 1 elements. Calculate the location of an element A(i, j)?
In an n x n C-matrix, all terms other than those in row 1, row n, and column 1 are zero. A C-matrix has at most 3n-2 nonzero terms. A C-matrix may be compactly stored in ...
Abhi_1o1
672
views
Abhi_1o1
asked
Aug 26, 2022
DS
data-structures
array
matrix
+
–
1
votes
1
answer
1845
ISI2020-PCB-CS: 1.2
What will be the output of the following C program? Justify your answer. Negative numbers are represented in $2$'s complement, #include<stdio.h> int main() { if (-~-1) printf("COVID"); if ((~7 & Ox000f ) == 8) printf (“19”); printf ("*"); }
What will be the output of the following C program? Justify your answer. Negative numbers are represented in $2$'s complement,#include<stdio.h int main() { if (-~-1) prin...
admin
492
views
admin
asked
Aug 18, 2022
Programming in C
isi2020-pcb-cs
programming
programming-in-c
number-representation
descriptive
+
–
0
votes
1
answer
1846
Ace academy test series question
prerona_99
329
views
prerona_99
asked
Aug 12, 2022
1
votes
1
answer
1847
ISI 2021 | PCB CS | Question: 4
Let $A$ be a matrix of size row $\times$ col. $A$ has to be filled in a spiral clockwise fashion with successive integers from $1,2, \ldots$, row $\times$ col starting from the top left corner. For example, a $3 \times 4$ ... (int *)); for(i=0;i<row;i++){ A[i] = (int *)calloc(col,sizeof(int)); } spiralFill(A,row,col); }
Let $A$ be a matrix of size row $\times$ col. $A$ has to be filled in a spiral clockwise fashion with successive integers from $1,2, \ldots$, row $\times$ col starting fr...
admin
644
views
admin
asked
Aug 8, 2022
Programming in C
isi2021-pcb-cs
programming
programming-in-c
functions
matrix
descriptive
+
–
0
votes
1
answer
1848
ISI2020-PCB-CS: 1.1
Consider the two $\mathrm{C}$ programs given below. C-CODE (I) #include<stdio.h> int main() { int n=2, *ptr=&n ; n*=3; printf ("%d", (*ptr**ptr)*(*ptr**ptr)); } C-CODE(II) #include<stdio.h> int main() { int n=2, *ptr=&n ; n*=3; ... $1296$ Output of (I) is $1296$ and (II) is $216$ Output of both (I) and (II) is $1296$ None of the above
Consider the two $\mathrm{C}$ programs given below.C-CODE (I)#include<stdio.h int main() { int n=2, *ptr=&n ; n*=3; printf ("%d", (*ptr ptr)*(*ptr ptr)); }C-CODE(II)#incl...
admin
414
views
admin
asked
Aug 8, 2022
Programming in C
isi2020-pcb-cs
programming
programming-in-c
pointers
+
–
4
votes
1
answer
1849
GO Classes Scholarship 2023 | Test | Question: 14
Consider the following C program given below. #include<stdio.h> main() { int a = 4; switch (a) { a--; case 4: printf("Science "); break; default: printf("Technology "); case ... ;Philosophy"); } } What will be the output of the program? Science Knowledge Philosophy Technology Knowledge Philosophy Science Knowledge
Consider the following C program given below.#include<stdio.h main() { int a = 4; switch (a) { a ; case 4: printf("Science "); break; default: printf("Technology "); case...
GO Classes
654
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
output
1-mark
+
–
3
votes
1
answer
1850
GO Classes Scholarship 2023 | Test | Question: 15
Consider Figure $\text{A}$ and Figure $\text{B}$ which represent $4$ bit signed and unsigned numbers respectively in $2's$ complement system. Assume that a few variables are defined below and initialized in such a way that places them in the spot shown in Figure ... of the following(s) is/are true? $s3 > u3$ $s1 > s3$ $u1 > u3$ $s1 > u3$
Consider Figure $\text{A}$ and Figure $\text{B}$ which represent $4$ bit signed and unsigned numbers respectively in $2’s$ complement system.Assume that a few variables...
GO Classes
752
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
number-representation
multiple-selects
2-marks
+
–
5
votes
1
answer
1851
GO Classes Scholarship 2023 | Test | Question: 19
Consider the following declaration of variable a in C program (row-major order). int a[3][4][5]; Which of the following(s) is/are TRUE about pointer arithmetic operations? Value of $a[2]-a[1]$ is $4$ Value of $a[1][2]-a[0][3]$ is $15$ Value of $a[0][10]-a[1][0]$ is $30$ Value of $a[2]-a[1]$ is $5$
Consider the following declaration of variable a in C program (row-major order).int a[3][4][5];Which of the following(s) is/are TRUE about pointer arithmetic operations?V...
GO Classes
786
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
array
multiple-selects
2-marks
+
–
2
votes
1
answer
1852
GO Classes Scholarship 2023 | Test | Question: 20
Consider the following declarations of a few variables. int (*p1)[3]; int (*p2)[3]; int (*t1)[2]; int (*t2)[2]; Let the initial values of $p1, p2, t2$ and $t1$ are $1000, 1036, 2000$ and $2040$ respectively. Consider ... is correct but $\text{S2}$ is incorrect $\text{S2}$ is correct but $\text{S1}$ is incorrect Both are correct Both are incorrect
Consider the following declarations of a few variables.int (*p1)[3]; int (*p2)[3]; int (*t1) ; int (*t2) ;Let the initial values of $p1, p2, t2$ and $t1$ are $1000, 1036,...
GO Classes
602
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
pointers
array-of-pointers
2-marks
+
–
3
votes
1
answer
1853
GO Classes Scholarship 2023 | Test | Question: 21
Let arrays OneD and TwoD are declared as follows as: int OneD[10]; int TwoD[4][5]; Which of the following is/are valid syntax to pass OneD and TwoD to some function fun()? A syntax is valid if it gets compiled without any warning or error. void fun(int OneD[10]); void fun(int OneD[5]); void fun(int TwoD[][5]); void fun(int **TwoD);
Let arrays OneD and TwoD are declared as follows as:int OneD[10]; int TwoD[4][5];Which of the following is/are valid syntax to pass OneD and TwoD to some function fun()?A...
GO Classes
714
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
array
multiple-selects
1-mark
+
–
4
votes
1
answer
1854
GO Classes Scholarship 2023 | Test | Question: 22
Consider below two program fragments. Assume malloc is always successful, and sizes are as follows - sizeof (int *)=8 bytes sizeof ( double)=8 bytes sizeof ( char )=1 byte sizeof ( int )=4 byte Program 1 int **p; p = (int ... run time error, but Program $1$ will run fine. Both programs will always run fine. Both programs may produce run time errors.
Consider below two program fragments.Assume malloc is always successful, and sizes are as follows -sizeof (int *)=8 bytes sizeof ( double)=8 bytes sizeof ( char )=1 byte ...
GO Classes
667
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
pointers
2-marks
+
–
5
votes
1
answer
1855
GO Classes Scholarship 2023 | Test | Question: 23
#include <stdio.h> int main() { int i= 255; short int *s= (short int *)&i; printf("%d\n", *s); } What will be the output of the above program in little-endian and big-endian, respectively? $(65280\text{ is } 255\times2^8)$ $255,\; 0$ $65280,\; 0$ $0,\;0$ $0,\; 65280$
#include <stdio.h int main() { int i= 255; short int *s= (short int *)&i; printf("%d\n", *s); }What will be the output of the above program in little-endian and big-endia...
GO Classes
641
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
number-representation
1-mark
+
–
2
votes
1
answer
1856
GO Classes Scholarship 2023 | Test | Question: 24
Consider the following function $\text{magic5().}$ void magic5(int x, int y){ if (condition) printf("magic"); } What condition we can write in “if-statement” such that $\text{magic5(5,5)}$ will print magic? !(x==5)!=!(y==5) (x==5)?!(y==5):(x==5) ((x==5)||(y==5))&&!((x==5)&&(y==5)) None of these
Consider the following function $\text{magic5().}$void magic5(int x, int y){ if (condition) printf("magic"); }What condition we can write in “if-statement” such that ...
GO Classes
346
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
operators
functions
1-mark
+
–
3
votes
1
answer
1857
GO Classes Scholarship 2023 | Test | Question: 28
What will be the output of the following program? #include<stdio.h> struct _go{ char b[20]; char *a; struct _go *c; }x[2] = {"GATE", "2023", x+1, "GO", "Classes", x}, *p = x; typedef struct_go go; go ... ;c, n-2); } int main() { printf("%s",mystry(p,2023)->a); } GATE $2023$ Run time error GO
What will be the output of the following program?#include<stdio.h struct _go{ char b[20]; char *a; struct _go *c; }x = {"GATE", "2023", x+1, "GO", "Classes", x}, *p = x;...
GO Classes
770
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
structure
recursion
2-marks
+
–
0
votes
1
answer
1858
Recursive function
Consider the following recursive function which is used by dynamic programming. T(n) = { 0; if n<1 1; if n=1 T(n-1)+T(n-2)+1; if n>1} Assume for every function call T(i) it checks the table first , if it's value is ... of 'n' so that overflow cannot occur . ( Assume system allocate 4 byte to each stack entry which is sufficient for storing required data.)
Consider the following recursive function which is used by dynamic programming. T(n) = { 0; if n<1 1; if n=1 T(n-1)+T(n-2)+1; if n>1}Assume ...
Manisha Jaishwal
681
views
Manisha Jaishwal
asked
Aug 6, 2022
Programming in C
recursion
dynamic-programming
+
–
1
votes
1
answer
1859
data structure and algorithms -- linked list -- size of a node
as we allocate the space for node in linked list using malloc() so how many bytes malloc allocate for the 1 node i.e. actual value of malloc allocates in ram like i write this code. so what is size of a node of linked ... node *)malloc(sizeof(struct node)); printf("%d",sizeof(struct node)); } what the printf prints and why ?
as we allocate the space for node in linked list using malloc() so how many bytes malloc allocate for the 1 node i.e. actual value of malloc allocates in ram like i write...
ykrishnay
704
views
ykrishnay
asked
Aug 5, 2022
Programming in C
data-structures
linked-list
algorithms
sorting
+
–
0
votes
1
answer
1860
NIELIT 2021 Dec Scientist B - Section B: 21
What will be the output of the following $\text{ C'}$ ... $3\;\;1\;\;2\;\;2\;\;1\;\;3\;\;4$ $3\;\;1\;\;2\;\;1\;\;1\;\;1\;\;2$
What will be the output of the following $\text{‘C’}$ program?void count(int n) { static int d = 1; printf(" %d", n); printf(" %d", d); d++; if (n>1) count (n - 1); p...
admin
274
views
admin
asked
Jul 21, 2022
Programming in C
nielit-2021-it-dec-scientistb
programming-in-c
+
–
Page:
« prev
1
...
88
89
90
91
92
93
94
95
96
97
98
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register