Recent questions in Programming and DS

0 votes
0 answers
3331
Struct exam{int a;char *c;}st[]={4,"choice",5,"battle",6,"minute",8,"bookmark",7,"address"}main(){struct exam *p=st;printf("%s",p++->c);++p;printf("%s",++p->c);printf("%...
1 votes
2 answers
3332
Int a ={{10,2,3,4},{5,6,7,8}};int *p;p=&a ;printf("%d",*p);this gives garbage value,what should be the changes to get p value as 10
1 votes
1 answer
3333
What is maximum possible height of BFS tree,if BSF is run on complete bipartisan graph Km,n where m>=1,n>=1 and starting vertex is S
0 votes
0 answers
3334
Suppose we use hash function h(n) to hash n distinct elements(keys) into an array of length m.what is expected number of colliding pairs of elements,if we use simple unif...
0 votes
0 answers
3335
main(){int x=1,y=0,z=5;int a=x && y&&z++;printf("%d",z);}what's the output and how is it evaluated
1 votes
2 answers
3337
let f(1)=1+(1/1) , f(2)= 1+(1/(1+(1/2))) , f(3)=1+(1/(1+(1/(1+(1/3)))))write a program in c which reads n and prints f(n)?
0 votes
1 answer
3338
short* a = 0;void main() {printf("%d",a);a=a+2; printf("%d",a);}
0 votes
2 answers
3339
main() { char check ='a'; switch(check) { case 'a'||1:printf("gats"); case 'b' || 2: printf("quiz"); break; default :printf("Gatesquiz"); } }a)gatesb)gatesquizc)gatesquiz...
1 votes
2 answers
3340
int main() { int a[5]={1,2,3,4,5}; int *ptr=(int *)(&a+1); // why is typecasting necessary here? It can just be int*ptr=&a+1; printf("%d%d",*(a+1),*(ptr-1)); }2 5garbagec...
0 votes
1 answer
3341
void fun(char str-ref){str-ref++;}main(){char *str=(void *)malloc(100*sizeof(char));strcpy(str,"Ravindran");fun(&str);puts(str);free(str);}a)ravindrasb)avindrasc)garbage...
0 votes
1 answer
3342
Main(){unsigned int x[4][3]={{1,2,3},{4,5,6},{7,8,9},{10,11,12}};printf("%u %u %u",x+3,*(x+3),*(x+2)+3);}A) 2036,2036,2036b)2012,4,2204c)2036,10,10d)2012,4,6
1 votes
1 answer
3343
main(){Char str[]="%d%s",arr[]="GatesQuiz";printf(str,0[arr],2[arr+3]);}a)GQb)71 81c)71 Qd) compile time error
1 votes
1 answer
3344
void my-toupper(char *str,int index){*(str+index)&=~32;}main(){char *arr="gatequiz";my-toupper(arr,0);my-toupper(arr,5);printf("%s",arr);}a)Gatesquizb)gatesquizc)compiler...
2 votes
1 answer
3345
main(){char a [3][3] = {'g','a','t','e','s','q','u','I','z'};printf("%s", a);the answer is gatequiz, to refer to a 3dimensional array the printf statement should be *a r...
1 votes
1 answer
3346
Int fun( char *str1){char *str2=str1;while(* ++str1); || here it accesses the data then increments or increments and then checks the data?return(str1-str2);}main(){char *...
1 votes
1 answer
3347
n=3;printf("%d %d",n++,++n);1) 3 5b) 4 5c) 4 4d) implementation dependent
0 votes
1 answer
3348
Int x,y=2,z,a;x=(y*=2)+(z=a=y);printf("%d",x);1) 82) 63) 8 or 6 depends on compiler4) syntax error
0 votes
1 answer
3349
Let a Nd b be two positive integers,which correctly relates / and %b=(a/b)*b+a%bb=(a%b)*b+a/ba=(a/b)*b+a%ba=(a%b)*b+a/b
1 votes
1 answer
3350
Consider putchar(getchar()); Putchar(getchar());the input is a and b then1.error message2.this cannot be the input3.ab4.a b