Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions and answers in Programming and DS
1
votes
2
answers
1
DRDO CSE 2022 Paper 1 | Question: 29
Five items $\text{A, B, C, D, E}$ are pushed onto a stack, one after other starting from item $\mathrm{A}$. The stack is then popped by three items, and each item is inserted into a queue. Next, two items are deleted from the queue, ... deleted items are pushed back onto the stack. Now, one item is popped from the stack. Which item is at the top of the stack.
Five items $\text{A, B, C, D, E}$ are pushed onto a stack, one after other starting from item $\mathrm{A}$. The stack is then popped by three items, and each item is inse...
soumya24
534
views
soumya24
answered
2 days
ago
DS
drdocse-2022-paper1
data-structures
stack
5-marks
descriptive
+
–
1
votes
0
answers
2
Arrays
Consider an integer upper triangular 2D array arr[–8 to +7][–8 to +7] having base address 1000. If the size of the integer is 4 bytes, the address of the element present at location arr[–6][4] is- ____________.
Consider an integer upper triangular 2D array arr[–8 to +7][–8 to +7] having base address 1000. If the size of the integer is 4 bytes, the address of the element pres...
piyush512
71
views
piyush512
asked
5 days
ago
DS
array
data-structures
+
–
2
votes
2
answers
3
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...
subhajit1998
2.2k
views
subhajit1998
answered
6 days
ago
Programming in C
gatecse2024-set1
multiple-selects
programming
programming-in-c
+
–
0
votes
1
answer
4
C Programming - Arrays & Pointer (NAT)
#include <stdio.h> int main() { int a[3][2] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; } (Assume size of int to be $2$ bytes.) The output is __________.
#include <stdio.h int main() { int a[3] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; }(Assume size of int to be $2$ bytes.)T...
archiii
79
views
archiii
answered
Apr 16
Programming in C
array
data-structures
programming-in-c
+
–
0
votes
0
answers
5
Bitwise Operator - C Programming
Problem Statement: Class teacher to IX-C wants to store whether a particular student has passed in exams. The class has a strength of $32$ students. Their roll numbers lie in the range: $[1, 32]$. The teacher used bits of an integer to store ... Bitwise OR (|) operator and count number of set bits d. Apply Bitwise AND (&) operator and count number of set bits
Problem Statement: Class teacher to IX-C wants to store whether a particular student has passed in exams. The class has a strength of $32$ students. Their roll numbers li...
Debargha Mitra Roy
135
views
Debargha Mitra Roy
asked
Apr 12
Programming in C
programming-in-c
operator-precedence
boolean-algebra
+
–
0
votes
1
answer
6
Consider the following program: #include <stdio.h> int main(){ int a=2, i; static int b=a++; for(i=0;i<a+b;i++) printf("GATE Wallah"); return 0; } Which of the following is/are CORRECT? (a) GATE Wallah is printed 3 times. (b) GATE Wallah is printed 4 times. (c) GATE Wallah is printed 5 times. (d) Compilation Error.
Consider the following program: #include <stdio.h int main(){ int a=2, i; static int b=a++; for(i=0;i<a+b;i++) printf("GATE Wallah"); return 0; }Which of the following is...
Sun Wukong
76
views
Sun Wukong
answered
Apr 12
0
votes
2
answers
7
C Programming - Recursion
What is the output of the below code? #include <stdio.h> void main() { static int var = 5; printf("%d ", var--); if (var) main(); } a. 1 2 3 4 5 b. 1 c. 5 4 3 2 1 d. Error
What is the output of the below code?#include <stdio.h void main() { static int var = 5; printf("%d ", var ); if (var) main(); }a. 1 2 3 4 5b. 1c. 5 4 3 2 1d. Error
Sun Wukong
122
views
Sun Wukong
answered
Apr 11
Programming in C
recursion
programming-in-c
programming
+
–
1
votes
1
answer
8
#Recursivefunctions
int bar(int val){ int x=0; while(val > 0){ x=x+bar(val -1); } return val; } Q: For bar(3) this function is supposed to be stuck in an infinite loop but I do not know how please can someone explain?
int bar(int val){int x=0;while(val 0){x=x+bar(val -1);}return val;}Q: For bar(3) this function is supposed to be stuck in an infinite loop but I do not know how please c...
Sun Wukong
93
views
Sun Wukong
answered
Apr 9
Programming in C
recursion
functions
+
–
0
votes
1
answer
9
class question self doubt
#include<stdio.h> #include<conio.h> int main(){ int a[][3]={ {4,14,24},{5,15,25},{6,16,26}}; int *p[3]; int **ptr=p; p[0]=a; p[1]=a+1; p[2]=a+2; ++*p; ++p[0]; ++**ptr; ++*p[0]; ++ptr; ++*ptr; --*p[1]; --*ptr; ++ptr; --p[ ... ("\n%d,%d,%d",a[0][2],a[1][1],a[2][0]); printf("\n%d,%d,%d",*p[0],*p[1],*p[2]); } what is the output of above program
#include<stdio.h>#include<conio.h>int main(){ int a[][3]={ {4,14,24},{5,15,25},{6,16,26}}; int *p[3]; int ptr=p; p[0]=a; p =a+1; p =a+2; ++*p; ...
C1h2a3i4t5
192
views
C1h2a3i4t5
answered
Apr 8
1
votes
2
answers
10
DRDO CSE 2022 Paper 1 | Question: 28
If the maximum height of a binary tree is $\mathrm{N},$ then how many number of nodes will there be?
If the maximum height of a binary tree is $\mathrm{N},$ then how many number of nodes will there be?
C1h2a3i4t5
293
views
C1h2a3i4t5
answered
Apr 8
DS
drdocse-2022-paper1
data-structures
binary-tree
4-marks
descriptive
+
–
0
votes
3
answers
11
Extern in C programming
int main() { extern int a = 20; printf("%d",a); } //why this gives error but followig code is not extern int a =20; int main() { printf("%d",a); } //why this happens that first code gives error but second is not ? //please tell i am realy confused now
int main(){extern int a = 20;printf("%d",a); }//why this gives error but followig code is not extern int a =20;int main(){printf("%d",a); } //why this happens that first ...
Abhishek_student
1.1k
views
Abhishek_student
answered
Apr 4
Programming in C
algorithms
programming-in-c
+
–
131
votes
4
answers
12
GATE CSE 2014 Set 2 | Question: 11
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set $p$ to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set $p$ correctly? $p = n * (n-1) * (n-2) / 6;$ $p = n * (n-1) / 2 * (n-2) / 3;$ $p = n * (n-1) / 3 * (n-2) / 2;$ $p = n * (n-1) * (n-2) / 6.0;$
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set $p$ to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set...
ayan2000
15.7k
views
ayan2000
answered
Mar 28
Programming in C
gatecse-2014-set2
programming
programming-in-c
normal
+
–
6
votes
4
answers
13
GO Classes Weekly Quiz 2 | Programming in C | Propositional Logic | Question: 2
What will be output printed by the following program? #include<stdio.h> main() { int c=4; switch(c) { c=c-1; case 4: printf("IITB "); break; default: printf("IISc "); case 3: printf("IITM " ... ;); } } $\text{IITB IITM}$ $\text{IITB IISc IITM}$ $\text{IITB}$ $\text{IITB IITM IITD}$
What will be output printed by the following program?#include<stdio.h main() { int c=4; switch(c) { c=c-1; case 4: printf("IITB ")...
geetaseshapallli
1.1k
views
geetaseshapallli
answered
Mar 26
Programming in C
goclasses_wq2
goclasses
programming
programming-in-c
output
1-mark
+
–
2
votes
3
answers
14
UPPCL AE 2018:34
What is the output of the following $\text{C}$ program? #include<stdio.h> int main(void){ char s1[] = “Hello”; char s2[] = “World!”; s1 = s2; printf(“%s”,s1); } “World!” “HelloWorld!” “Compilation error” “Hello”
What is the output of the following $\text{C}$ program?#include<stdio.h int main(void){ char s1[] = “Hello”; char s2[] = “World!”; s1 = s2; printf(“%s”,s1); }...
geetaseshapallli
424
views
geetaseshapallli
answered
Mar 26
Programming in C
uppcl2018
programming
programming-in-c
output
+
–
18
votes
4
answers
15
GATE CSE 2023 | Question: 25
The integer value printed by the $\textsf{ANSI-C}$ program given below is _______________ #include<stdio.h> int funcp(){ static int x = 1; x++; return x; } int main(){ int x,y; x = funcp(); y = funcp()+x; printf("%d\n", (x+y)); return 0; }
The integer value printed by the $\textsf{ANSI-C}$ program given below is _______________#include<stdio.h int funcp(){ static int x = 1; x++; return x; } int main(){ int ...
ritiksri8
11.0k
views
ritiksri8
answered
Mar 25
Programming in C
gatecse-2023
programming
programming-in-c
output
numerical-answers
1-mark
+
–
0
votes
1
answer
16
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.
cprdereddyy
491
views
cprdereddyy
answered
Mar 25
Programming in C
gate1988
descriptive
programming
lisp
out-of-gate-syllabus
+
–
1
votes
0
answers
17
GATE CSE SET-1 2024
My question is that can we use command line arguments without use of main function's parameters argc and *argv?
My question is that can we use command line arguments without use of main function's parameters argc and *argv?
RahulVerma3
153
views
RahulVerma3
asked
Mar 22
Programming in C
programming-in-c
programming
+
–
40
votes
11
answers
18
GATE CSE 2021 Set 2 | Question: 10
Consider the following $\text{ANSI C}$ program. #include <stdio.h> int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) { for (j=0; j<5; j++) { arr[i][j] = 10 * i + j; } } printf(“%d”, *(arr[1]+9)); return 0; } What is the output of the above program? $14$ $20$ $24$ $30$
Consider the following $\text{ANSI C}$ program.#include <stdio.h int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) { for (j=0; j<5; j++) { arr[i...
Subham640
30.3k
views
Subham640
answered
Mar 18
Programming in C
gatecse-2021-set2
programming-in-c
array
output
1-mark
+
–
48
votes
8
answers
19
GATE CSE 2015 Set 3 | Question: 7
Consider the following C program segment. # include <stdio.h> int main() { char s1[7] = "1234", *p; p = s1 + 2; *p = '0'; printf("%s", s1); } What will be printed by the program? $12$ $120400$ $1204$ $1034$
Consider the following C program segment.# include <stdio.h int main() { char s1[7] = "1234", *p; p = s1 + 2; *p = '0'; printf("%s", s1); }What will be printed by the pro...
Subham640
16.3k
views
Subham640
answered
Mar 17
Programming in C
gatecse-2015-set3
programming
programming-in-c
normal
array
+
–
0
votes
0
answers
20
GATE 2024 CSE1
I have a question that can we use command line arguments without main function arguments? int main(int argc, char **argv){ }
I have a question that can we use command line arguments without main function arguments?int main(int argc, char argv){}
RahulVerma3
148
views
RahulVerma3
asked
Mar 16
Programming in C
gatecse2024-set1
programming-in-c
+
–
0
votes
1
answer
21
Gate 2017 Set 1 minimum Comparisons
Consider an array A of size 31 consisting of 0's followed by number of 1's. In order to find the smallest index i such that A[i]=1 minimum number of comparisons required in worst case by optimal algorithm?
Consider an array A of size 31 consisting of 0's followed by number of 1's. In order to find the smallest index i such that A[i]=1 minimum number of comparisons required ...
teja1521
220
views
teja1521
answered
Mar 11
Programming in C
numerical-answers
algorithms
+
–
2
votes
2
answers
22
let x be an array of integer which of the following can not be present in the LHS of an assignment statement
let x be an array of integer . which of the following can not be present in the left hand side of an assignment statementa)x b) x+i c) * (x+i) d) &x[i]
teja1521
2.6k
views
teja1521
answered
Mar 11
1
votes
3
answers
23
UGC NET CSE | December 2004 | Part 2 | Question: 22
Suppose we are implementing quadratic probing with a Hash function, Hash $(y)=X$ mode $100$. If an element with key $4594$ is inserted and the first three locations attempted are already occupied, then the next cell that will be tried is : $2$ $3$ $9$ $97$
Suppose we are implementing quadratic probing with a Hash function, Hash $(y)=X$ mode $100$. If an element with key $4594$ is inserted and the first three locations attem...
ajayraho
1.7k
views
ajayraho
answered
Mar 11
DS
ugcnetcse-dec2004-paper2
+
–
1
votes
1
answer
24
DRDO CSE 2022 Paper 1 | Question: 26 (b)
Provide the correct data structures for the following: Asynchronous data transfer and accessing shared resource involve _________.
Provide the correct data structures for the following:Asynchronous data transfer and accessing shared resource involve _________.
mishraamulya
340
views
mishraamulya
answered
Mar 10
DS
drdocse-2022-paper1
data-structures
1-mark
fill-in-the-blanks
+
–
1
votes
1
answer
25
Array
Does C support fractional Indices? float x = some fraction; Is float a[x] valid declaration?
Does C support fractional Indices?float x = some fraction;Is float a[x] valid declaration?
teja1521
176
views
teja1521
answered
Mar 8
Programming in C
array
programming-in-c
+
–
2
votes
3
answers
26
Made Easy Mock -1
how does the program is working..? answer – 8
how does the program is working..?answer – 8
teja1521
423
views
teja1521
answered
Mar 8
Programming in C
programming
numerical-answers
made-easy-test-series
+
–
6
votes
3
answers
27
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)...
teja1521
420
views
teja1521
answered
Mar 8
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
recursion
output
2-marks
+
–
1
votes
3
answers
28
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') ...
shah___
3.1k
views
shah___
answered
Mar 6
Programming in C
gatecse2024-set1
programming
programming-in-c
+
–
0
votes
1
answer
29
s.balaguruswami
Find the error of the following IP addresses. If the IP is valid, check its Class and determine whether the address is Unicast or Multicast. i) 237.15.2.1 ii) 256.1.8.9 iii) 114.34.2.8 iv) 255.254.0.1 v) 8.8.8.8
Find the error of the following IP addresses. If the IP is valid, check its Class and determine whether the address is Unicast or Multicast.i) 237.15.2.1ii) 256.1.8.9iii)...
sanjeet24
110
views
sanjeet24
answered
Mar 5
2
votes
2
answers
30
find the output
include <stdio.h> int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; printf("%d %d ", (*ptr)[1], (*ptr)[2]); ++ptr; printf("%d %d\n", (*ptr)[1], (*ptr)[2]); return 0; } (a) 2 3 5 6 (b) 2 3 4 5 (c) 4 5 0 0 (d) none of the above
include <stdio.h int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; printf("%d %d ", (*ptr) , (*ptr) ); ++ptr; printf("%d %d\n", (*ptr) , (*ptr) ); return 0...
ritiksri8
6.0k
views
ritiksri8
answered
Mar 4
Programming in C
programming-in-c
+
–
1
votes
1
answer
31
c programming
#include <stdio.h> int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; } output is 255 , but please explain how
#include <stdio.h int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; }output is 255 , but please explain how
AniMan_7
256
views
AniMan_7
answered
Feb 29
Programming in C
programming-in-c
+
–
4
votes
2
answers
32
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; }...
AniMan_7
3.8k
views
AniMan_7
answered
Feb 28
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
70
votes
13
answers
33
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...
B Bhatta
28.0k
views
B Bhatta
answered
Feb 28
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
array
pointers
+
–
59
votes
4
answers
34
GATE CSE 2014 Set 2 | Question: 40
Consider the following function. double f(double x){ if( abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); } Give a value $q$ (to $2$ decimals) such that $f(q)$ will return $q$:_____.
Consider the following function.double f(double x){ if( abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); }Give a value $q$ (to $2$ decimals) such that $f(q)$ wi...
B Bhatta
19.2k
views
B Bhatta
answered
Feb 26
Programming in C
gatecse-2014-set2
programming
recursion
numerical-answers
normal
+
–
0
votes
1
answer
35
Linked List
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.
꧁༒☬ĿọŗԀ 🆂🅷🅸🆅🅰☬༒꧂
184
views
꧁༒☬ĿọŗԀ 🆂🅷🅸🆅🅰☬༒꧂
answered
Feb 26
Programming in C
linked-list
data-structures
algorithms
+
–
1
votes
0
answers
36
I have purchased the IIIT Hyderabad 2024 test series but i can't find the test series anywhere
Khushbu Chaudhary
106
views
Khushbu Chaudhary
asked
Feb 25
9
votes
3
answers
37
GO Classes Test Series 2024 | Programming | Test 1 | Question: 24
What will be the output of the following C program? Assume that negative numbers are represented using $2’s$ complement. #include<stdio.h> void main() { int a = 2; a = ~a+2 << 1; printf("%d",a); }
What will be the output of the following C program?Assume that negative numbers are represented using $2’s$ complement.#include<stdio.h void main() { int a = 2; a = ~a+...
ritiksri8
987
views
ritiksri8
answered
Feb 25
Programming in C
goclasses2024-programming-1-weekly-quiz
numerical-answers
goclasses
programming
programming-in-c
output
1-mark
+
–
3
votes
2
answers
38
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", ...
ritiksri8
298
views
ritiksri8
answered
Feb 25
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
loop
output
2-marks
+
–
4
votes
3
answers
39
GO Classes Scholarship 2023 | Test | Question: 16
Consider the following declaration of variables $a$ and $b.$ int a = 1, b = 0; Which of the following is/are will evaluate to TRUE? b++ && b == a b++ && a == 0 a || b == --a a || ++b == 0
Consider the following declaration of variables $a$ and $b.$int a = 1, b = 0;Which of the following is/are will evaluate to TRUE?b++ && b == ab++ && a == 0a || b == aa |...
ritiksri8
730
views
ritiksri8
answered
Feb 25
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
multiple-selects
2-marks
+
–
7
votes
2
answers
40
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 33
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x[2]+4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \textsf{x}$ $\ast((*(x+16))+28)$ $\ast((*(x+2))+7)$ $\ast(((* x)+2)+7)$ $(* \ast(x+2)+7)$
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x +4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \text...
teja1521
454
views
teja1521
answered
Feb 25
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
pointers
1-mark
+
–
To see more, click for all the
questions in this category
.
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register