Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged programming-in-c
5
votes
0
answers
1411
Evaluation order in return statement
//Consider the following C program #include <stdio.h> int f(int *a,int *b,int c) { if(c == 0) return 1; else { *b = *b-1; *a = *a+1; c = c - 1; return *a + f(a,b,c) + *b; } } int main() { int ... ,c)); return 0; } Doubts : Is there any undefined behaviour according to C language? if NO, then what will be the output ? Please explain with proper explanation.
//Consider the following C program #include <stdio.h int f(int *a,int *b,int c) { if(c == 0) return 1; else { *b = *b-1; *a = *a+1; c = c - 1; return *a + f(a,b,c) + *b; ...
dd
1.5k
views
dd
asked
Jan 21, 2017
Programming in C
programming-in-c
+
–
12
votes
1
answer
1412
C programming
#include <stdio.h> int f(int *a,int b) { b = b-1; if(b == 0) return 1; else { *a = *a+1; return *a + f(a,b) ; } } int main() { int X = 5; printf("%d\n",f(&X,X)); } Predict the output If the return statement was return f(a,b)+ *a ; What would have been the output here ? Explain why there is change in output (if any)
#include <stdio.h int f(int *a,int b) { b = b-1; if(b == 0) return 1; else { *a = *a+1; return *a + f(a,b) ; } } int main() { int X = 5; printf("%d\n",f(&X,X)); }Predict ...
Aboveallplayer
3.4k
views
Aboveallplayer
asked
Jan 20, 2017
Programming in C
programming-in-c
+
–
1
votes
1
answer
1413
MadeEasy Subject Test: Programming & DS - Programming in C
vaishali jhalani
311
views
vaishali jhalani
asked
Jan 20, 2017
Programming in C
made-easy-test-series
programming-in-c
programming
+
–
1
votes
0
answers
1414
output
vaishali jhalani
207
views
vaishali jhalani
asked
Jan 20, 2017
Programming in C
programming-in-c
+
–
0
votes
1
answer
1415
test series
shubhamdarokar
493
views
shubhamdarokar
asked
Jan 19, 2017
Programming in C
test-series
programming-in-c
+
–
0
votes
1
answer
1416
test series
shubhamdarokar
354
views
shubhamdarokar
asked
Jan 19, 2017
Programming in C
test-series
programming-in-c
+
–
0
votes
3
answers
1417
test series
shubhamdarokar
702
views
shubhamdarokar
asked
Jan 19, 2017
Programming in C
test-series
programming-in-c
+
–
0
votes
0
answers
1418
testboook
i take m=4 and n=3? and after doing recursive calls i get 10 answer so how D) option will be correct ??
i take m=4 and n=3? and after doing recursive calls i get 10 answer so how D) option will be correct ??
focus _GATE
325
views
focus _GATE
asked
Jan 18, 2017
Programming in C
test-series
testbook-test-series
programming-in-c
+
–
5
votes
2
answers
1419
Row Major
Assume that an upper triangular matrix A[0... 99, 0 ...99] is stored in a linear array C of size 5050 with row major order. If A[0, 0] is stored in C[0], find the index of C where A[70, 90] is stored in it.
Assume that an upper triangular matrix A[0... 99, 0 ...99] is stored in a linear array C of size 5050 with row major order. If A[0, 0] is stored in C[0], find the index o...
srestha
5.5k
views
srestha
asked
Jan 16, 2017
Programming in C
programming
programming-in-c
array
+
–
0
votes
1
answer
1420
Test by Bikram | Mock GATE | Test 1 | Question: 43
What is the output of the following code snippet? #include<stdio.h> int main ( ) { int x = 2, y = 5; if (x < y) return (x = x+y); else printf (“ GO Mock 1 ”); printf(“ Welcome to GO Mock test ”); } GO Mock 1 Welcome to GO Mock Test No output GO Mock 1Welcome to GO Mock Test
What is the output of the following code snippet?#include<stdio.h int main ( ) { int x = 2, y = 5; if (x < y) return (x = x+y); else printf (“ GO Mock 1 ”); printf(�...
Bikram
919
views
Bikram
asked
Jan 16, 2017
GATE
tbb-mockgate-1
programming
programming-in-c
+
–
5
votes
3
answers
1421
Test by Bikram | Mock GATE | Test 1 | Question: 6
What is the output of the following program? main( ) { int i=4, z=12; if( i=5 || z > 50) printf(“ Gate2017”); else printf(“ Gateoverflow”); } Gate2017 Gateoverflow syntax error Gate2017Gateoverflow
What is the output of the following program?main( ){int i=4, z=12;if( i=5 || z 50)printf(“ Gate2017”);elseprintf(“ Gateoverflow”);}Gate2017Gateoverflowsyntax err...
Bikram
972
views
Bikram
asked
Jan 16, 2017
GATE
tbb-mockgate-1
programming
programming-in-c
+
–
1
votes
1
answer
1422
Test by Bikram | Mock GATE | Test 1 | Question: 2
Find the output of the following program : #include <stdio.h> main () { int a, b; int v=3; int *pv; a = 2 * (v+5); pv = &v; b = 2*(*pv + 5); printf("\n a=%d b=%d " , a,b); } $a = 16$ , $b = 16$ $a = 16$ , $b = 32$ $a = 16$ , $b = 8$ $a = 16$ , $b = 64$
Find the output of the following program :#include <stdio.h main () { int a, b; int v=3; int *pv; a = 2 * (v+5); pv = &v; b = 2*(*pv + 5); printf("\n a=%d b=%d " , a,b); ...
Bikram
290
views
Bikram
asked
Jan 16, 2017
GATE
tbb-mockgate-1
programming-in-c
programming
pointers
+
–
0
votes
1
answer
1423
Virtual Gate Test Series: Programming & DS - Define
#define THIS 0 #define THAT 0 #include <stdio.h> int main(int argc, char const *argv[]) { #ifdef THIS && THAT printf("if\n"); #else printf("else\n"); #endif return 0; } What is the output? What happens if the first two lines are not initializing. i.e., #define THIS #define THAT
#define THIS 0 #define THAT 0 #include <stdio.h int main(int argc, char const *argv[]) { #ifdef THIS && THAT printf("if\n"); #else printf("else\n"); #endif return 0; }Wha...
Dulqar
274
views
Dulqar
asked
Jan 15, 2017
Programming in C
programming-in-c
virtual-gate-test-series
+
–
0
votes
1
answer
1424
Tree BFS
int func(Node root) { int x = 0; int y = 0; queue Q; Q.push(root); while(!Q.empty()) { Node u = Q.top(); Q.pop(); if(u->left == NULL && u->right == NULL) x++; if(u->left != NULL) { y++; Q.push(u->left); } if(u->right != NULL) { y++; Q.push(u->right); } } return x+y; } Above code segment is executed on the following rooted tree: What will be the output?
int func(Node root) { int x = 0; int y = 0; queue Q; Q.push(root); while(!Q.empty()) { Node u = Q.top(); Q.pop(); if(u->left == NULL && u->right == NULL) x++; if(u->left ...
dd
483
views
dd
asked
Jan 13, 2017
Programming in C
breadth-first-search
programming-in-c
binary-tree
+
–
0
votes
1
answer
1425
Testbook question, Answer please
vijay_jr
275
views
vijay_jr
asked
Jan 12, 2017
Programming in C
programming-in-c
+
–
0
votes
1
answer
1426
General doubt on calculating the Time complexity for the given Insertion Sort Algorithm in the worst and average case
INSERTION-SORT (A, n) ⊳ A[1 . . n]for (j ← 2 to len(A) ){key ← A[ j];i ← j – 1 ; while (i 0 and A[i] key) { A[...
LavTheRawkstar
808
views
LavTheRawkstar
asked
Jan 12, 2017
Algorithms
algorithms
time-complexity
sorting
programming-in-c
data-structures
+
–
1
votes
2
answers
1427
switch case output in case of expressions
#include int main() { char check = 'a'; switch (check) { case 'a' || 1: printf("Gates "); case 'b' || 2: printf("Quiz "); break; default: printf("GatesQuiz"); } return 0; } (a) Gates (b) Gates Quiz (c) Gates Quiz GatesQuiz (d) Compile-time error
#includeint main(){ char check = 'a';switch (check){case 'a' || 1: printf("Gates ");case 'b' || 2: printf("Quiz ");break;default: printf("GatesQuiz");} return 0; }(a) Gat...
Akriti sood
1.6k
views
Akriti sood
asked
Jan 12, 2017
Programming in C
programming-in-c
+
–
0
votes
0
answers
1428
self soubt
while (++x){ } here ++x is executed first and then condition is checked or first condition is checked then ++x
while (++x){}here ++x is executed first and then condition is checked or first condition is checked then ++x
Akriti sood
297
views
Akriti sood
asked
Jan 12, 2017
Programming in C
programming-in-c
+
–
2
votes
2
answers
1429
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...
Akriti sood
5.9k
views
Akriti sood
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
3
votes
2
answers
1430
Testbook question
b*2 b*c-2 b+c*2 none of these
b*2b*c-2b+c*2none of these
vijay_jr
382
views
vijay_jr
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
2
votes
1
answer
1431
find the output
#include int main() { char *x; x = (char *) &a; a = 512; x[0] = 1; x[1] = 2; printf("%d\n",a); return 0; } What is the output of above program? (a) Machine dependent b) 513 (c) 258 (d) Compiler Error
#includeint main(){char *x;x = (char *) &a;a = 512;x[0] = 1;x = 2;printf("%d\n",a);return 0;}What is the output of above program?(a) Machine dependentb) 513(c) 258(d) Co...
Akriti sood
553
views
Akriti sood
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
0
votes
0
answers
1432
In the following program where is the variable a getting defined and where it is getting declared?
In the following program where is the variable a getting defined and where it is getting declared? #include int main() { extern int a; printf("%d\n", a); return 0; } int a=20; (a) extern int a ... definition (c) int a = 20 is definition, a is not defined (d) a is declared, a is not defined
In the following program where is the variable a getting defined and where it is getting declared?#includeint main(){ extern int a;printf("%d\n", a);return 0;} int a=20;(...
Akriti sood
2.5k
views
Akriti sood
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
0
votes
1
answer
1433
Is there any difference between following declarations?
Is there any difference between following declarations? 1: extern int fun(); 2: int fun(); (a) Both are identical (b) No difference, except extern int fun(); is probably in another file (c) int fun(); is overrided with extern int fun() ; ... ------------------ i think both are same as compiler converts int func() to extern int func() implictly
Is there any difference between following declarations?1: extern int fun();2: int fun();(a) Both are identical(b) No difference, except extern int fun(); is probably in a...
Akriti sood
970
views
Akriti sood
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
1
votes
0
answers
1434
self doubt
just confused in these things- we are perfoming a/b if we have two INT variables a=6 and b=2 in which scenario we will get answe as 3 3.0 similarly ,if they are float then when will we get 3 3.0 if we have two floats as a=3.2 and b= 1.1 then what will be the answer on division
just confused in these things-we are perfoming a/bif we have two INT variables a=6 and b=2in which scenario we will get answe as 33.0similarly ,if they are float then whe...
Akriti sood
285
views
Akriti sood
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
4
votes
1
answer
1435
MadeEasy Subject Test: Programming & DS - Programming in C
What is the functionality of above function Do ( ) ? a. Check whether string is odd palindrome b. Check whether the string is even palindrome c. Check whether the string is palindrome d. None of the above
What is the functionality of above function Do ( ) ?a. Check whether string is odd palindromeb. Check whether the string is even palindromec. Check whether the string is...
yankur9
505
views
yankur9
asked
Jan 10, 2017
Programming in C
made-easy-test-series
programming-in-c
programming
+
–
5
votes
2
answers
1436
C programming
int i=0; char *a = "abcde\0efgh"; while(a[++i]) printf("%d",*++a - 'a'); the output of the above c code segment?
int i=0; char *a = "abcde\0efgh"; while(a[++i]) printf("%d",*++a - 'a');the output of the above c code segment?
dd
1.1k
views
dd
asked
Jan 10, 2017
Programming in C
programming-in-c
output
pointers
+
–
1
votes
4
answers
1437
Virtual Gate Test Series: Programming & DS - Output Of The Program
What will be the output$?$ int main() { int varl = 35,*var2,*var3; var2 = &var1; //suppose the address of var1 is 1006 var3 = var2; *var2++ = *var3++; var1++; printf("var1 = %d var2 = %d var3 = %d ",var1,var2,var3); return 0; } 36 1010 1010 38 1006 1006 37 1006 1010 38 1010 1006
What will be the output$?$int main() { int varl = 35,*var2,*var3; var2 = &var1; //suppose the address of var1 is 1006 var3 = var2; *var2++ = *var3++; var1++; ...
Purple
842
views
Purple
asked
Jan 10, 2017
Programming in C
programming-in-c
output
virtual-gate-test-series
+
–
1
votes
2
answers
1438
Virtual Gate Test Series: Programming & DS - Output Of The Program
What is the output$?$ #define THIS #define THAT void main() { #ifdef THIS && THAT printf("I love beer"); #else printf("I love chicken"); #endif } I love beer I love chicken Segmentation fault Syntax error
What is the output$?$#define THIS #define THAT void main() { #ifdef THIS && THAT printf("I love beer"); #else printf("I love chicken"); #endif }I ...
Purple
308
views
Purple
asked
Jan 10, 2017
Programming in C
programming-in-c
output
virtual-gate-test-series
+
–
0
votes
1
answer
1439
Virtual Gate Test Series: Programming & DS - String
Which functions of string include the null terminator '\0'? I know strlen() doesn't include the '\0' in giving the length, does anyone know which other functions include and which do not include?
Which functions of string include the null terminator '\0'? I know strlen() doesn't include the '\0' in giving the length, does anyone know which other functions include ...
Purple
359
views
Purple
asked
Jan 10, 2017
Programming in C
programming-in-c
virtual-gate-test-series
+
–
0
votes
1
answer
1440
C Programming Doubt
char *p; *p='a' ; I know this will give compiler error but can anyone explain what is the actual bug in this and how to rectify it??
char *p;*p='a' ;I know this will give compiler error but can anyone explain what is the actual bug in this and how to rectify it??
sushmita
938
views
sushmita
asked
Jan 9, 2017
Programming in C
programming-in-c
pointers
+
–
Page:
« prev
1
...
43
44
45
46
47
48
49
50
51
52
53
...
64
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register