main()

{

char p[ ]="%d\n";

p[1] = 'c';

printf(p,65);

}

Answers were Sorted based on User's Feedback



main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p..

Answer / susie

Answer :

A

Explanation:

Due to the assignment p[1] = ‘c’ the string becomes, “%c\n”.
Since this string becomes the format string for printf and
ASCII value of 65 is ‘A’, the same gets printed.

Is This Answer Correct ?    30 Yes 3 No

main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p..

Answer / hunny kukreja

Answer:
65

Explanation:
As p is having "%d\n",so it has become format string
for printf,so same will get printed.i.e. number 65

Is This Answer Correct ?    4 Yes 11 No

Post New Answer

More C Code Interview Questions

Printf can be implemented by using __________ list.

3 Answers  


Cau u say the output....?

1 Answers  


main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  


What are segment and offset addresses?

2 Answers   Infosys,






Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);

1 Answers  


union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }

1 Answers  


write a c program to Reverse a given string using string function and also without string function

1 Answers  


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


Categories