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
Answer / guest
d) World, copies World on a, overwrites Hello in a.
| Is This Answer Correct ? | 13 Yes | 1 No |
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 |
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 |
Answer / vijeselvam
answer is (d)
The correct answer will be "HelloHello"
| Is This Answer Correct ? | 0 Yes | 0 No |
main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }
How can i find first 5 natural Numbers without using any loop in c language????????
what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }
How can you relate the function with the structure? Explain with an appropriate example.
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.
21 Answers ABC, eBay, Goldman Sachs, Google, HUP, Microsoft, TATA,
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
write a program for area of circumference of shapes