Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage for Programming:
Recent questions tagged programming
1
votes
1
answer
661
Pointer Casting
Analyze what is happening and why? int *ptr=(int*)0X12341230; int *ptr2=((int*)(((char*)ptr)+1)); char *ptr=(char*) 0X12341230; void *ptr2=ptr+1;
Analyze what is happening and why?int *ptr=(int*)0X12341230; int *ptr2=((int*)(((char*)ptr)+1));char *ptr=(char*) 0X12341230; void *ptr2=ptr+1;
srestha
421
views
srestha
asked
Jul 27, 2017
Programming in C
programming-in-c
programming
pointers
+
–
2
votes
0
answers
662
Made Easy Gate Test Series
The correct answer to the following question is 24. Please explain.
The correct answer to the following question is 24. Please explain.
Akash Mishra
980
views
Akash Mishra
asked
Jul 26, 2017
DS
made-easy-test-series
stack
data-structures
programming
+
–
0
votes
2
answers
663
How do I solve this recursion?
What is the value of F(n, m)? Function F(n, m : integer) : integer; begin if(n <= 0) or (m <= 0) then F:=1 else F := F(n-1, m) + F(n, m-1); end;
What is the value of F(n, m)?Function F(n, m : integer) : integer; begin if(n <= 0) or (m <= 0) then F:=1 else F := F(n-1, m) + F(n, m-1); end;
Akash Mishra
575
views
Akash Mishra
asked
Jul 7, 2017
Programming in C
recursion
programming
data-structures
+
–
2
votes
2
answers
664
char output in c. Predict the output of following C programs
Predict the output of following C programs 1. #include int main() { char a = '\012'; printf("%d", a); return 0; } 2. #include int main() { char a = '012'; printf("%d", a); return 0; } 3. #include int main() { char a = '\012'; printf("%c", a); return 0; }
Predict the output of following C programs1.#includeint main(){ char a = '\012'; printf("%d", a); return 0;}2.#includeint main(){ char a = '012'; printf...
Khushal Kumar
3.5k
views
Khushal Kumar
asked
Jul 4, 2017
Programming in C
programming
programming-in-c
output
datatype
+
–
2
votes
1
answer
665
SSelf
The value returned by the following function for foo(10) is ____ int foo(int x) { if(x < 1) return 1; int sum = 0; for(i = 1; i <= x; i++) { sum += foo(x-i); } return sum; }
The value returned by the following function for foo(10) is ____ int foo(int x) { if(x < 1) return 1; int sum = 0; for(i = 1; i <= x; i++) { sum += foo(x-i); } return sum...
Kuldeep Pal
531
views
Kuldeep Pal
asked
Jun 25, 2017
Programming in C
programming-in-c
programming
+
–
0
votes
1
answer
666
Dssb it 2017
How many primitive data type are there in java????? And: 8 Plz explain it
How many primitive data type are there in java?????And: 8Plz explain it
Harikesh Kumar
294
views
Harikesh Kumar
asked
Jun 8, 2017
Programming in C
programming-in-c
programming
+
–
0
votes
1
answer
667
Test by Bikram | Mock GATE | Test 4 | Question: 45
Consider the following code snippet: #include <stdio.h> void s1(int*, int); void s2(int*, int); void (*k[2])(int*, int); int main() { int a = 4; int b = 2; k[0] = s1; k[1] = s2; k[0](&a, b); printf("%d %d ", a, ... void s2(int *k, int q) { int tmp = *k; *k = q; q = tmp; } The output of the above program is : 4242 2222 4444 2424
Consider the following code snippet:#include <stdio.h void s1(int*, int); void s2(int*, int); void (*k )(int*, int); int main() { int a = 4; int b = 2; k[0] = s1; k = s2...
Bikram
427
views
Bikram
asked
May 14, 2017
Programming in C
tbb-mockgate-4
programming
programming-in-c
array-of-pointers
+
–
1
votes
1
answer
668
Test by Bikram | Mock GATE | Test 4 | Question: 18
Consider the below code snippet: #include<stdio.h> int main() { int p[15][20][29] = {0}; p[4][2][3] = 6; --------------- return 0; } Which of the following options will print $6$ when added in the missing part of the above code? printf(" ... **((p+4)+2)+3); printf("%d",*(*((p+4)+2)+3)); printf("%d",*(((p+4)+2)+3));
Consider the below code snippet:#include<stdio.h int main() { int p[15][20][29] = {0}; p[4] [3] = 6; - return 0; }Which of the following options will print $6$ when ad...
Bikram
312
views
Bikram
asked
May 14, 2017
GATE
tbb-mockgate-4
programming
programming-in-c
+
–
3
votes
1
answer
669
Test by Bikram | Mock GATE | Test 4 | Question: 6
Consider the below $C$ code: #include<stdio.h> int main() { char a[] = "gateoverflow"; char *p = a; printf("%s", p+p[3]-p[1]); } The output will be : gate eoverflow overflow Garbage error
Consider the below $C$ code:#include<stdio.h int main() { char a[] = "gateoverflow"; char *p = a; printf("%s", p+p[3]-p ); }The output will be : gate eoverflow overflo...
Bikram
270
views
Bikram
asked
May 14, 2017
Programming in C
tbb-mockgate-4
programming
programming-in-c
+
–
1
votes
1
answer
670
Static and Dynamic links in Activation Records?
Can Anyone explain me the difference between Static and Dynamic links in Activation Records With some illustration or eg ?
Can Anyone explain me the difference between Static and Dynamic links in Activation Records With some illustration or eg ?
Himanshu Goyal
2.4k
views
Himanshu Goyal
asked
May 4, 2017
Programming in C
compiler-design
programming
dynamic
linker
+
–
1
votes
4
answers
671
difference between dynamic programming and divide and conquer technique is
What is the difference between dynamic programming and divide and conquer technique,
What is the difference between dynamic programming and divide and conquer technique,
LavTheRawkstar
6.2k
views
LavTheRawkstar
asked
Apr 17, 2017
Algorithms
divide-and-conquer
algorithms
dynamic-programming
programming
+
–
0
votes
2
answers
672
ISRO 2008-ECE exit() function
The library function exit ( ) causes as exit from (a) the loop in which it occurs (b) the block is which it occurs (c) the functions in which it occurs (d) the progam in which it occurs
The library function exit ( ) causes as exit from (a) the loop in which it occurs(b) the block is which it occurs(c) the functions in which it occurs(d) the progam in whi...
sh!va
1.4k
views
sh!va
asked
Mar 2, 2017
Programming in C
isro-ece
programming
+
–
0
votes
1
answer
673
ISRO 2008-ECE programming
A program having features such as data abstraction, encapsulation and data hiding, polymorphism inheritance is called (a) Structured program (b) Object oriented program (c) Open source program (d) Real time program
A program having features such as data abstraction, encapsulation and data hiding, polymorphism inheritance is called(a) Structured program(b) Object oriented program(c) ...
sh!va
375
views
sh!va
asked
Mar 2, 2017
Programming in C
isro-ece
programming
object-oriented-programming
+
–
102
votes
9
answers
674
GATE CSE 2017 Set 1 | Question: 53
Consider the following C program. #include<stdio.h> #include<string.h> void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t); printf("%d\n", len); } ... in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
Consider the following C program.#include<stdio.h #include<string.h void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) c) ? strlen...
srestha
25.2k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
68
votes
5
answers
675
GATE CSE 2017 Set 1 | Question: 55
The output of executing the following C program is _______________ . #include<stdio.h> int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return count; } void main() { static int x=0; int i=5; for(; i>0; i--) { x = x + total(i); } printf("%d\n", x); }
The output of executing the following C program is _______________ .#include<stdio.h int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return c...
srestha
22.6k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
54
votes
7
answers
676
GATE CSE 2017 Set 2 | Question: 43
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$: int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done =0; int i; while (done==0) { done =1; for (i=0; i<=4; i ... i-1]) { swap(&array[i], &array[i-1]); done =0; } } } printf( %d , array[3]); } The output of the program is _______
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$:int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done...
Arjun
17.1k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
algorithms
numerical-answers
identify-function
+
–
36
votes
6
answers
677
GATE CSE 2017 Set 2 | Question: 37
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int. while (r >= y) { r=r-y; q=q+1; } Which of the following conditions on the variables $x, y, q$ and $r$ ... $(q==0) \ \&\& \ (y>0)$
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int.while (r >...
Arjun
14.3k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
loop-invariants
+
–
104
votes
7
answers
678
GATE CSE 2017 Set 1 | Question: 36
Consider the C functions foo and bar given below: int foo(int val) { int x=0; while(val > 0) { x = x + foo(val--); } return val; } int bar(int val) { int x = 0; while(val > 0) { x ... in: Return of $6$ and $6$ respectively. Infinite loop and abnormal termination respectively. Abnormal termination and infinite loop respectively. Both terminating abnormally.
Consider the C functions foo and bar given below:int foo(int val) { int x=0; while(val 0) { x = x + foo(val ); } return val; }int bar(int val) { int x = 0; while(val 0)...
Arjun
25.6k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
normal
recursion
+
–
47
votes
11
answers
679
GATE CSE 2017 Set 1 | Question: 35
Consider the following two functions. void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("%d", n); ... printf("%d", n); } The output printed when $\text{fun1}(5)$ is called is $53423122233445$ $53423120112233$ $53423122132435$ $53423120213243$
Consider the following two functions.void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("...
Arjun
20.5k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
normal
tricky
recursion
+
–
87
votes
7
answers
680
GATE CSE 2017 Set 1 | Question: 13
Consider the following C code: #include<stdio.h> int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return; x = assignval (x,0); ... and not as shown. compiles successfully but execution may result in dangling pointer. compiles successfully but execution may result in memory leak.
Consider the following C code:#include<stdio.h int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return...
Arjun
35.5k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
pointers
+
–
26
votes
3
answers
681
GATE CSE 2017 Set 2 | Question: 2
Match the following: ... ; R-i; S-iii P-ii; Q-i; R-iv; S-iii P-ii; Q-iv; R-iii; S-i P-iii; Q-iv; R-i; S-ii
Match the following:$$\begin{array}{|ll|ll|}\hline P. & \text{static char var ;} & \text{i.} & \text{Sequence of memory locations to store addresses} \\\hline Q. & \text...
khushtak
5.9k
views
khushtak
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
programming-in-c
match-the-following
+
–
2
votes
1
answer
682
Test by Bikram | Mock GATE | Test 3 | Question: 42
Read the below code snippet: int joo( int num ) { int result = 0 ; if ( num <= 1) return 1; else { for ( i=num; i >= 1; i - - ) { result + = joo( i / 3) ; } } return result; } When $num = 6$, the return value of the function is _____.
Read the below code snippet: int joo( int num ) { int result = 0 ; if ( num <= 1) return 1; else { for ( i=num; i >= 1; i - - ) { result + = joo( i / 3) ; } } return r...
Bikram
338
views
Bikram
asked
Feb 9, 2017
GATE
tbb-mockgate-3
programming
programming-in-c
identify-function
numerical-answers
+
–
2
votes
1
answer
683
Test by Bikram | Mock GATE | Test 3 | Question: 31
What is the output of the below mentioned code snippet? void goo(char *p) { if( p[0] = = ’\0’) return; goo(p+1); goo(p+1); printf("%c", p[0]); } main() { goo("123"); } $3$ $3$ $2$ $1$ $3$ $2$ $1$ $3$ $2$ $3$ $1$ $3$ $2$ $1$ $3$ $3$ $2$ $3$ $3$ $2$ $1$ $3$ $3$ $3$ $1$ $3$ $3$ $2$
What is the output of the below mentioned code snippet?void goo(char *p) { if( p[0] = = ’\0’) return; goo(p+1); goo(p+1); printf("%c", p[0]); } main() { goo("123"); }...
Bikram
227
views
Bikram
asked
Feb 9, 2017
GATE
tbb-mockgate-3
programming
programming-in-c
+
–
0
votes
1
answer
684
Test by Bikram | Mock GATE | Test 3 | Question: 26
The following function finds the $GCD$ recursively. int GCD(int k, int u) { if( u = = 0 ) return k ; else return GCD( u , ____); } Fill in the blank with the most appropriate function: $k/u$ $u/k$ $u \% k$ $k \% u$
The following function finds the $GCD$ recursively. int GCD(int k, int u) { if( u = = 0 ) return k ; else return GCD( u , ____); }Fill in the blank with the most appropri...
Bikram
374
views
Bikram
asked
Feb 9, 2017
GATE
tbb-mockgate-3
programming
programming-in-c
identify-function
+
–
0
votes
1
answer
685
Ace Test Series: Programming & DS - Programming In C
#include<stdio.h> int main() { char *p; p = "%d\n"; p++; p++; printf(p-2, 400); return 0; } Output : 400 I ran this program and got 400 as output. But I don't understand why it is so?
#include<stdio.h>int main() { char *p; p = "%d\n"; p++; p++; printf(p-2, 400); return 0;}Output : 400I ran this program and got 400 as output. But I don...
Hemant Parihar
541
views
Hemant Parihar
asked
Feb 3, 2017
Programming in C
ace-test-series
programming-in-c
programming
+
–
0
votes
1
answer
686
Ace Test Series: Programming & DS - Programming In C
Sonali Rangwani
483
views
Sonali Rangwani
asked
Feb 2, 2017
Programming in C
ace-test-series
programming
programming-in-c
+
–
2
votes
2
answers
687
Ace Test Series: Programming & DS - Programming In C
asriv
551
views
asriv
asked
Jan 30, 2017
Programming in C
ace-test-series
programming
programming-in-c
+
–
0
votes
1
answer
688
Ace Test Series: Programming & DS - Programming In C
Sonali Rangwani
636
views
Sonali Rangwani
asked
Jan 29, 2017
Programming in C
programming
programming-in-c
ace-test-series
+
–
1
votes
0
answers
689
Loop invariants [GateBook]
biranchi
529
views
biranchi
asked
Jan 24, 2017
Programming in C
programming
datas
data-structures
algorithms
+
–
2
votes
1
answer
690
predict the output|testbook livetest
will there be no compile time error as we are initialising array greater than its size??
will there be no compile time error as we are initialising array greater than its size??
Akriti sood
280
views
Akriti sood
asked
Jan 23, 2017
Programming in C
programming
programming-in-c
testbook-test-series
+
–
Page:
« prev
1
...
18
19
20
21
22
23
24
25
26
27
28
...
32
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register