main()

{

char *a = "Hello ";

char *b = "World";

clrscr();

printf("%s", strcpy(a,b));

}

a. “Hello”

b. “Hello World”

c. “HelloWorld”

d. None of the above

Answers were Sorted based on User's Feedback



main() { char *a = "Hello "; char *b = "World"; cl..

Answer / guest

d) World, copies World on a, overwrites Hello in a.

Is This Answer Correct ?    13 Yes 1 No

main() { char *a = "Hello "; char *b = "World"; cl..

Answer / sandeep tayal

This would produce an error message if you are using g++
compiler in UNIX as g++ does not allow constant strings to
be a part of the char *;

If this is run in Turbo C then it will produce the output
shown in above

Is This Answer Correct ?    3 Yes 0 No

main() { char *a = "Hello "; char *b = "World"; cl..

Answer / sanjay bhosale

This produces runtime exception as we are attempting to read or write protected memory in Visual c++.

Is This Answer Correct ?    1 Yes 0 No

main() { char *a = "Hello "; char *b = "World"; cl..

Answer / vijeselvam

answer is (d)

The correct answer will be "HelloHello"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

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,


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 pascal f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } void cdecl f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }

1 Answers  


what is the code of the output of print the 10 fibonacci number series

2 Answers  


void main() { printf(“sizeof (void *) = %d \n“, sizeof( void *)); printf(“sizeof (int *) = %d \n”, sizeof(int *)); printf(“sizeof (double *) = %d \n”, sizeof(double *)); printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *)); }

1 Answers  


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


Write a program to print a square of size 5 by using the character S.

6 Answers   Microsoft,


What is your nationality?

1 Answers   GoDB Tech,


How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.

1 Answers  


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


Categories