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

main() { extern out; printf("%d", out); } int out=100;

1 Answers  


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?

2 Answers  


main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

1 Answers  


main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,






main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); } int i;

1 Answers  


What are the files which are automatically opened when a C file is executed?

1 Answers  


How can you relate the function with the structure? Explain with an appropriate example.

0 Answers  


#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }

3 Answers  


main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4

18 Answers   HCL, IBM, Infosys, LG Soft, Satyam,


int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }

1 Answers  


main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

2 Answers   CSS, Wipro,


Categories