Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged programming-in-c
2
votes
1
answer
1381
Is it possible to have a function call on the left hand side of the equality operator?
Is it possible to have a function call on the left hand side of the equality operator? a. No, because you can only have variables on the left side b. Yes, but only in case of functions that do not ... of functions that return a pointer value d. Yes, but only in case of functions that return a reference value.
Is it possible to have a function call on the left hand side of the equality operator?a. No, because you can only have variables on the left sideb. Yes, but only in case ...
Meenakshi Sharma
587
views
Meenakshi Sharma
asked
Feb 24, 2017
Object Oriented Programming
non-gate
programming-in-c
+
–
2
votes
1
answer
1382
C programming
int a[20]; unsigned int m; // global variable int foo(int a[]) { int i=0,count = 0; while(i < 20) m |= 1<<(a[i++]-1); i = (sizeof(int)<<3)-1; while(i>=0) if(m&(1<<(i--))) count++; return count; } In the above ... elements in a[] which are more than $20$ B No of distinct elements in a[] which less than $20$ C No of distinct elements in a[] D None of these
int a[20]; unsigned int m; // global variable int foo(int a[]) { int i=0,count = 0; while(i < 20) m |= 1<<(a[i++]-1); i = (sizeof(int)<<3)-1; while(i>=0) if(m&(1<<(i ))) ...
dd
556
views
dd
asked
Feb 18, 2017
Programming in C
programming-in-c
output
+
–
102
votes
9
answers
1383
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.0k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
68
votes
5
answers
1384
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.4k
views
srestha
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
+
–
70
votes
13
answers
1385
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...
Madhav
27.9k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
array
pointers
+
–
104
votes
7
answers
1386
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.3k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
normal
recursion
+
–
87
votes
7
answers
1387
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.4k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set1
programming-in-c
programming
pointers
+
–
25
votes
7
answers
1388
GATE CSE 2017 Set 2 | Question: 54
Consider the following C program. #include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n--; --n1; n-=n1; printf(“%d”, n); return 0; } The output of the program is ______
Consider the following C program.#include<stdio.h int main () { int m=10; int n, n1; n=++m; n1=m++; n ; n1; n-=n1; printf(“%d”, n); return 0; }The output of the prog...
Madhav
11.9k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
easy
+
–
30
votes
11
answers
1389
GATE CSE 2017 Set 2 | Question: 14
Consider the following function implemented in C: void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); } The output of invoking $printxy(1,1)$ is: $0, 0$ $0, 1$ $1, 0$ $1, 1$
Consider the following function implemented in C:void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); }The output of invoking $...
Madhav
9.7k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
identify-function
pointers
+
–
26
votes
3
answers
1390
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.8k
views
khushtak
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
programming-in-c
match-the-following
+
–
2
votes
1
answer
1391
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
332
views
Bikram
asked
Feb 9, 2017
GATE
tbb-mockgate-3
programming
programming-in-c
identify-function
numerical-answers
+
–
2
votes
1
answer
1392
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
223
views
Bikram
asked
Feb 9, 2017
GATE
tbb-mockgate-3
programming
programming-in-c
+
–
0
votes
1
answer
1393
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
364
views
Bikram
asked
Feb 9, 2017
GATE
tbb-mockgate-3
programming
programming-in-c
identify-function
+
–
0
votes
0
answers
1394
pre-post increment
#include <stdio.h> int main(void) { int i,j,k,l; i=j=k=l=4; int a=(++i)*(++i)*(++i); int b = (j++)*(j++)*(j++); int c = (k++)*(++k)*(k++); int d = (l++)*(++l)*(++l); printf("%d\t%d\t%d\t%d",a,b,c,d); return 0; } Please explain the output. Thanks in advance. The output is: 252 64 125 150
#include <stdio.h>int main(void){int i,j,k,l;i=j=k=l=4;int a=(++i)*(++i)*(++i);int b = (j++)*(j++)*(j++);int c = (k++)*(++k)*(k++);int d = (l++)*(++l)*(++l);printf("%d\t%...
erh
637
views
erh
asked
Feb 9, 2017
Programming in C
programming-in-c
+
–
0
votes
0
answers
1395
byron gottfried programming in c (schaum's outline) pageno:302 and 303
i wanted to intialize a 2d array using pointers to pointers and i wrote the following code i know the below code is lot of hardcoding but as i am a beginner to pointers i want to do it this way,please help me ... )+s)); } printf("\n"); } return 0; } https://gateoverflow.in/?qa=blob&qa_blobid=17604332813334679423
i wanted to intialize a 2d array using pointers to pointers and i wrote the following code i know the below code is lot of hardcoding but as i am a beginner to pointers i...
abhijeeth
596
views
abhijeeth
asked
Feb 8, 2017
Programming in C
programming-in-c
array-of-pointers
memory-management
+
–
4
votes
1
answer
1396
GateBook_MockTest2(Programming)
# include < stdio.h > main ( ) { float total 0.0, q = 1.0, p = 2.0; while (p/q> 0.001) { q = q + q ; total = total + p/q ; print f (“% f\n”, total) ; } } Which one of the following is the integer that best approximates the last number printed ? (A) 0 (B) 1 (C) 2 (D) 3
# include < stdio.h >main ( ){float total 0.0, q = 1.0, p = 2.0;while (p/q 0.001){q = q + q ;total = total + p/q ;print f (“% f\n”, total) ;}}Which one of the followi...
smartmeet
925
views
smartmeet
asked
Feb 7, 2017
Programming in C
programming-in-c
gatebook-mt2
+
–
1
votes
1
answer
1397
Programming Output
Determine the output- #include <stdio.h> int main(void) { char *p="gateoverflow"; *(p+5)='z'; printf("%s",p); return 0; }
Determine the output-#include <stdio.h int main(void) { char *p="gateoverflow"; *(p+5)='z'; printf("%s",p); return 0; }
Samujjal Das
554
views
Samujjal Das
asked
Feb 6, 2017
Programming in C
programming-in-c
output
pointers
+
–
0
votes
1
answer
1398
Ace Test Series
AmitPatil
435
views
AmitPatil
asked
Feb 4, 2017
Programming in C
programming-in-c
+
–
0
votes
1
answer
1399
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
538
views
Hemant Parihar
asked
Feb 3, 2017
Programming in C
ace-test-series
programming-in-c
programming
+
–
0
votes
4
answers
1400
What is the output || Single linked list ?
struct node{ int num; struct node *next; } void print(struct node *ptr) { if(ptr) { printf("%d",ptr->data); do{ printf("%d",ptr->data); } while(ptr->next); } } What is the output, if a $SLL : 1\rightarrow 2\rightarrow 3\rightarrow 4\rightarrow 5$ is passed in the above $C$ code ? Assume Head pointer at Node $1$
struct node{ int num; struct node *next; } void print(struct node *ptr) { if(ptr) { printf("%d",ptr->data); do{ printf("%d",ptr->data); } while(ptr->next); } }What is the...
Kapil
1.4k
views
Kapil
asked
Feb 3, 2017
DS
linked-list
data-structures
programming-in-c
output
+
–
0
votes
1
answer
1401
C program
What is the error in the following code . Please do correct them #include <stdio.h> int main () { char *x[5] = {"raju","ramu","tinu","ben","ali"}; printf("%s\n",(x[2][0]) ); return 0; }
What is the error in the following code . Please do correct them#include <stdio.h int main () { char *x[5] = {"raju","ramu","tinu","ben","ali"}; printf("%s\n",(x [0]) ); ...
Dulqar
437
views
Dulqar
asked
Feb 3, 2017
Programming in C
programming-in-c
+
–
1
votes
2
answers
1402
C programming
char *x[5] = {"abc","def","ghi","jkl","mno"}; char *y[5] = {"123","456","789","101","102"}; struct hcode { char *word; }hcodes[5]; struct key { int id; char *word; struct hcode *password; } ... ); return 0; } $A.$ 456,hi,01,no $B.$ 456,ghi,101,mno $C.$ 56,hi,01,no $D.$ 456,ef,01,no
char *x[5] = {"abc","def","ghi","jkl","mno"}; char *y[5] = {"123","456","789","101","102"}; struct hcode { char *word; }hcodes[5]; struct key { int id; char *word; struct...
dd
1.3k
views
dd
asked
Feb 2, 2017
Programming in C
programming-in-c
output
pointers
+
–
0
votes
1
answer
1403
Ace Test Series: Programming & DS - Programming In C
Sonali Rangwani
479
views
Sonali Rangwani
asked
Feb 2, 2017
Programming in C
ace-test-series
programming
programming-in-c
+
–
1
votes
1
answer
1404
c language
In c language a«2 is equivalent to a) multiply by 2 b) divide by 2 c) addition by 2 d) none my answer is option a but given answer is d.. pls tell me wht is correct ansr
In c language a«2 is equivalent toa) multiply by 2b) divide by 2c) addition by 2d) none my answer is option a but given answer is d..pls tell me wht is correct ansr
krati litoriya
537
views
krati litoriya
asked
Feb 1, 2017
Programming in C
programming-in-c
+
–
2
votes
2
answers
1405
Ace Test Series: Programming & DS - Programming In C
asriv
544
views
asriv
asked
Jan 30, 2017
Programming in C
ace-test-series
programming
programming-in-c
+
–
3
votes
1
answer
1406
Time Complexity of the given code ?
#include <stdio.h> int main(void) { for(i=1;i<=n;i*=2) { for(j=0;j<=i;j++) { for(k=0;k<=n;k++) { ..... O(1)....; } } } return 0; } What is the time complexity of given code ?
#include <stdio.h int main(void) { for(i=1;i<=n;i*=2) { for(j=0;j<=i;j++) { for(k=0;k<=n;k++) { ..... O(1)....; } } } return 0; }What is the time complexity of given code...
Kapil
1.0k
views
Kapil
asked
Jan 29, 2017
Algorithms
time-complexity
algorithms
programming-in-c
+
–
0
votes
1
answer
1407
Ace Test Series: Programming & DS - Programming In C
Sonali Rangwani
617
views
Sonali Rangwani
asked
Jan 29, 2017
Programming in C
programming
programming-in-c
ace-test-series
+
–
5
votes
6
answers
1408
column major in 3d array
Consider 3 dimensional Array A[90] [30] [40] stored in linear array in column major order. If the base address starts at 10. The location of A[20] [20] [30] is __________ . [Assume the first element is stored at A[1][1][1] and each element take 1 B].
Consider 3 dimensional Array A[90] [30] [40] stored in linear array in column major order. If the base address starts at 10. The location of A[20] [20] [30] is __________...
Pankaj Joshi
15.9k
views
Pankaj Joshi
asked
Jan 26, 2017
Programming in C
array
programming-in-c
data-structures
+
–
1
votes
1
answer
1409
Multi dimensional array
Pankaj Joshi
314
views
Pankaj Joshi
asked
Jan 25, 2017
Programming in C
programming-in-c
pointers
+
–
0
votes
1
answer
1410
programming c
#include <stdio.h> int a; int ar[4]={1,0,2,3}; int main() { a=0; foo(ar[a],ar[ar[a]]); printf("%d%d%d%d",ar[0],ar[1],ar[2],ar[3]); return 0; } foo(int x,int y) { x=x+1; y=y+1; x=x+1; y=y+1; ar[1]=50; } what will be the output if C uses pass by reference(suppose) ? a. 1 50 2 3 b. 3 50 2 3 c. 3 2 2 3 d. none
#include <stdio.h>int a;int ar[4]={1,0,2,3};int main(){ a=0; foo(ar[a],ar[ar[a]]); printf("%d%d%d%d",ar[0],ar ,ar ,ar[3]); return 0;}foo(int x,int y){ x=x+1; ...
Shivamp
294
views
Shivamp
asked
Jan 24, 2017
Programming in C
programming-in-c
+
–
Page:
« prev
1
...
42
43
44
45
46
47
48
49
50
51
52
...
64
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register