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

Find the largest number in a binary tree

7 Answers   Infosys,


main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(“%u %u %u %d \n”,a,*a,**a,***a); printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1); }

2 Answers  


Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,


why the range of an unsigned integer is double almost than the signed integer.

1 Answers  


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  






main() { int i=5; printf(“%d”,i=++i ==6); }

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  


String reverse with time complexity of n/2 with out using temporary variable.

10 Answers   NetApp, Symantec,


Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; }

1 Answers  


Categories