main()

{

char name[10],s[12];

scanf(" \"%[^\"]\"",s);

}

How scanf will execute?

Answers were Sorted based on User's Feedback



main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } ..

Answer / susie

Answer :

First it checks for the leading white space and discards
it.Then it matches with a quotation mark and then it reads
all character upto another quotation mark.

Is This Answer Correct ?    6 Yes 2 No

main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } ..

Answer / banoth manjula9

No

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }

3 Answers   Accenture,


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 Answers  


main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16

4 Answers   HCL,


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,






Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!

8 Answers   GATE,


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


Categories