search
Log In

Recent questions tagged output

0 votes
1 answer
1
The question is based on the following program fragment. f(intY[10],int x){ int u,j,k; i=0;j=9; do{ k=(i+j)/2; if(Y[k] < x) i=k; else j=k; } while(Y[k]!=x) && (i<j)); if (Y[k]==x) printf( x is in the array. ); else printf( x is not in the array. ); } On which of the following contents of ... $x>2$ $Y$ is $[2\;4\;6\;8\;10\;12\;14\;16\;18\;20]$ and $2<x<20$ and $'x'$ is even
asked Apr 1 in Programming Lakshman Patel RJIT 154 views
0 votes
1 answer
2
0 votes
1 answer
3
0 votes
2 answers
4
0 votes
2 answers
5
0 votes
0 answers
6
The question is based on the following program fragment. f(intY[10],int x){ int u,j,k; i=0;j=9; do{ k=(i+j)/2; if(Y[k] < x) i=k; else j=k; } while(Y[k]!=x) && (i<j)); if (Y[k]==x) printf( x is in the array. ); else printf( x is not in the array. ); } On which of the following contents of ... $x>2$ $Y$ is $[2\;4\;6\;8\;10\;12\;14\;16\;18\;20]$ and $2<x<20$ and $'x'$ is even
asked Apr 1 in Programming Lakshman Patel RJIT 57 views
5 votes
3 answers
7
#include int main( ) { int x=5, y=9; x=(x= x+y)-(y= x-y); printf("%d %d ", x, y); return 0; } A. 9 5 B. 5 14 C. 14 5 D. 5 9
asked Mar 5 in Programming vivek_mishra 240 views
0 votes
1 answer
8
#include<stdio.h> #include<stdlib.h> int main(void) { int maxLineCount = 500, maxCharCount = 500, index, j, count; char *line = NULL; size_t size; char *a[maxLineCount]; for (index = 0; index < maxLineCount; index++) a[index] = (char *)malloc(maxCharCount * ... of the code is doing. suppose we have 3 string given as input in 3 different lines then how can we access each character of the string?
asked Jun 1, 2019 in Programming Satbir 613 views
0 votes
1 answer
9
What will be the output of the below code? the answer given is E)0 but I am not getting it. #include <stdio.h> void fun(short int *a,char *b) { b += 2; short int *p = (short int*)b; *p = *a; } int main() { void (*fptr)(short int *,char *) short int a = 101; char ... *fptr)(&a,arr); printf("%d", arr[3]); return 0; } $A)$ Compilation error. $B) 100$ $C)$ Garbage Value $D)$ Segmentation Fault. $E) 0$
asked May 18, 2019 in Programming Aishvarya Akshaya Vi 343 views
2 votes
2 answers
10
Can someone explain the output of this code? and what (char*) is doing actually? #include<stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c", '*((char*)q+1)', '*((char*)q+2)'); return 0; }
asked May 13, 2019 in Programming srestha 258 views
0 votes
1 answer
11
Can someone tell me, why these two same program giving different output?Is there any problem in code or compiler not producing right? Program1 Program2
asked May 6, 2019 in Programming srestha 139 views
0 votes
1 answer
12
#include <stdio.h> #include<stdlib.h> int main() { //code char *ptr,s[]="debasree"; ptr=s[0]; printf("%s\n",*ptr); return 0; } I get this warning in geeks for geeks compiler Warnings: prog.c: In function 'main': prog.c:7:6: warning: assignment ... Segmentation Fault (SIGSEGV) can anyone pls explain what is the warning saying? i googled a lot but could not grasp it pls pls pls pls explain...
asked Apr 24, 2019 in Programming debasree88 333 views
0 votes
1 answer
13
X=2; Y=++x * ++x * ++x ; Printf("%d",Y); In the above question, we have to use the final value of x or it will be evaluated seperately and then multiplied. Ex: Y= 3*4*5; or Y=5*5*5;
asked Apr 11, 2019 in Programming Ashish Roy 1 182 views
0 votes
0 answers
14
Can somebody explain this code line by line. I am unable to get and what will be it's output? #include<stdio.h> #include<stdlib.h> void transpose(int n, const double *A, double *B, const int *lda, int *perm) { } int transpose_equal(const double *A, const double*B, int total_size ... (ndim, B_trans, B, r_dim, r_perm); transpose_equal(A, B, total); free(A); free(B); free(B_trans); printf("\n"); } }
asked Apr 3, 2019 in Programming srestha 112 views
1 vote
0 answers
15
In the above 4 Statements which would print 123 as output ? Explain also.
asked Mar 16, 2019 in Programming Ashish Roy 1 266 views
0 votes
1 answer
16
void print(int i){ static int x=4; if(i!=0){ print(--x); } printf("%d",x); } What will be output printed for print(10)? Will it print value as call by value or call by reference?
asked Mar 1, 2019 in Programming srestha 176 views
2 votes
0 answers
17
What will be the final output : #include <stdio.h> int r(){ static int num=7; return num--; } int main(){ for(r();r();r()) { printf("%d ",r()); } return 0; } A)63 B)41 C)52 D)630
asked Feb 7, 2019 in Programming _shashi 1.5k views
0 votes
1 answer
18
when i printing x it is giving 0 but when comparing x with 5 ,it executing else part ,means condition fail ,why ?? #include <stdio.h> int main(void) { int x; if(x=(printf("Hello")) != 5) printf("Hello"); else printf("World \n"); printf("%d \n",x); return 0; } https://ideone.com/NJSj2i
asked Jan 28, 2019 in Programming Gurdeep Saini 103 views
0 votes
0 answers
19
int main() { int a=2,b=2,c=2; printf("%d",a==b==c); return 0; } what is the output??? and what will be done during execution can anyone explain this……...
asked Jan 19, 2019 in Programming shiva0 106 views
0 votes
1 answer
20
#include<stdio.h> int main() { FILE *fp[2]; if((fp[0]=fp[1]=fopen("test.txt","w"))!=NULL) //test.txt file should be empty during first compiling { fputs("one",fp[0]); fclose(fp[0]); fputs("two",fp[1]); fclose(fp[1]); } return 0; } what will be printed ... and also am not understanding what is done after fputs("one",fp[0]); and fputs("two",fp[1]); can anyone tell me with explanation...please .
asked Jan 19, 2019 in Programming shiva0 76 views
2 votes
3 answers
21
#include <stdio.h> int arr[] = { 10, 20, 30, 40, 50 }; static int count ; inc() { return ++count; } int main() { arr[count++]=inc(); printf("%d ", arr[count]); printf("%d ", arr[0]); } https://ideone.com/5LOuqj
asked Jan 14, 2019 in Programming Gurdeep Saini 459 views
0 votes
0 answers
22
is *ptr=&a is true in C i found this in can anyone explain what does *ptr = &i; in the above picture
asked Jan 14, 2019 in Programming shiva0 117 views
0 votes
0 answers
23
#include<stdio.h> #include<string.h> int main() { char fullname[]="abcd"; char firstname[]="xxxxx"; //char lastName[]='Nagula'; printf("enter number\n"); printf("Press 1 for fullname\n"); printf("Press 2 for firstname\n"); printf("Press 3 for lastname\n"); int ... output it is giving error :invalid initialiser in line char name[]= ( a==1 ? fullname : firstname); how to correct it. thank you..!
asked Jan 13, 2019 in Programming shiva0 62 views
0 votes
1 answer
24
#include<stdio.h> #define A -B #define B -C #define C 5 int main() { printf("The value of A is %dn", A); return 0; } what is the output?????
asked Jan 12, 2019 in Programming shiva0 70 views
0 votes
1 answer
25
main() { unsigned int i= 255; char *p= &i; int j= *p; printf("%d\n", j); unsigned int k= *p; printf("%d", k); } Both the outputs are -1. I have even tried with - int i = 255(3rd line). Still the output is -1. I don't understand how it is -1.
asked Jan 12, 2019 in Programming Psnjit 266 views
1 vote
1 answer
26
#include <stdio.h> main (){ unsigned x = -10; int X = 20; if (X > x) printf ("Hello"); else{ printf ("%d",x); printf ("Jello"); } }
asked Jan 8, 2019 in Programming Na462 179 views
0 votes
0 answers
27
#include<stdio.h> void main(){ int p=-8; int i= (p++,++p); printf("%d\n",i); }
asked Jan 8, 2019 in Programming aimhigh 443 views
0 votes
0 answers
28
# include <stdio.h> int main( void ) { static int i = 6; if(--i){ main(); printf(“%d’,i+1); } return 0; } Let X be Number of 0’s and Y be number of 1’s printed by the code ..the value of 2X+Y is ? Answer is 5 here How?
asked Jan 1, 2019 in Programming Ashwani Yadav 101 views
4 votes
1 answer
29
Consider the following C language code: #include<stdio.h> int main() { int x=64; int i=0; while (i++<3) x=(((x<<2)+(x>>1))>>1); printf("%d", x); return 0; } What is the output of the above code?
asked Dec 27, 2018 in Programming and DS Ruturaj Mohanty 453 views
0 votes
0 answers
30
#include<stdio.h> int main() { char A[5][7][6]; char *p[5][7][6]; printf(“%d\t”,(unsigned)(A+1)-(unsigned)A); printf(“%d”,(unsigned)(p+1)-(unsigned)p); } OPTIONS: 42 42 1 1 42 336 336 42
asked Dec 22, 2018 in Programming utkarshkosta 80 views
...