main()

{

char * strA;

char * strB = I am OK;

memcpy( strA, strB, 6);

}

a. Runtime error.

b. I am OK

c. Compile error

d. I am O

Answers were Sorted based on User's Feedback



main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / chandra

Answer is (c)compile error

compiler cannot initialize the string with out "". Hence any
compiler throws an error

If the string is with in "", then answer will be(a) Runtime
error.
since the string strA is used with out being initialized

Is This Answer Correct ?    6 Yes 0 No

main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / guest

c) I am OK is not in " "

Is This Answer Correct ?    5 Yes 2 No

main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / madhu

Runtime error

Is This Answer Correct ?    2 Yes 1 No

main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a...

Answer / prashant

if quotes are inserted ans will be -->
d) I am O

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Code Interview Questions

¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...

3 Answers  


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  


Write a routine to implement the polymarker function

0 Answers   TCS,


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


how to check whether a linked list is circular.

11 Answers   Microsoft,






main() { clrscr(); } clrscr();

2 Answers  


void main() { int i=5; printf("%d",i++ + ++i); }

3 Answers  


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world”

5 Answers   HCL,


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above

3 Answers   HCL,


main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

1 Answers  


Categories