ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
#include<stdio.h>
main()
{
	char *p1;
	char *p2;
	p1=(char *) malloc(25);
	p2=(char *) malloc(25);
	strcpy(p1,"Ramco");
	strcpy(p2,"Systems");
	strcat(p1,p2);
	printf("%s",p1);
}

Tell me the output?
 Question Submitted By :: Naveed
I also faced this Question!!     Rank Answer Posted By  
 
  Re: #include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
Answer
# 1
25Ramco25Systems
 
Is This Answer Correct ?    1 Yes 1 No
Mastan Vali.shaik
 
  Re: #include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
Answer
# 2
The output will b : RamcoSystems
 
Is This Answer Correct ?    3 Yes 0 No
Fazlur Rahaman Naik
 
 
 
  Re: #include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
Answer
# 3
the output will be RamcoSystems
but we need 2 more libraries
#include<string.h> and
#include<alloc.h>
to run this program. in else case it will not work.
 
Is This Answer Correct ?    0 Yes 0 No
Sumant
 
  Re: #include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
Answer
# 4
#include<stdio.h>

main()
{
        char *p1,*p2;
        p1 = (char *)malloc(25);
        p2 = (char *)malloc(25);
        strcpy(p1,"Ramco");
        strcpy(p2,"Systems");
        strcat(p1,p2);
        printf("%s",p1);
}



the output will be RamcoSystems

we don't need the following libraries under Linux 2.6
#include<string.h> and
#include<alloc.h>
to run this program.
 
Is This Answer Correct ?    0 Yes 0 No
V.srinivasan
 
  Re: #include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
Answer
# 5
The program is not correct. What is present in memory 
beyond "Ramco" is not known and we are trying to 
attach "Systems". May be we are overwriting something which 
is unsafe.

To concatenate two strings declare the first as array.

example: char p1[50];
char *p2;
p2 = malloc(25);
strcpy(p1, "Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
 
Is This Answer Correct ?    0 Yes 0 No
Mage
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
C passes By value or By reference? Geometric-Software5
helllo sir , what is the main use of the pointer ,array ,and the structure with the example of a programe  2
Binary tree traversing Qualcomm1
What is memmove? Oracle1
how to find the binary of a number? Infosys5
Is the following code legal? struct a { int x; struct a b; }  3
main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i]); } what will be the output? } NDS15
who did come first hen or agg Infosys12
write a program to find out number of on bits in a number? Huawei12
how to find out the biggest element (or any other operation) in an array which is dynamic. User need not to mention the array size while executing.  2
write a 'c' program to sum the number of integer values  5
1,1,5,17,61,217,?,?.  3
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack  5
what are the interview question's in the language c Nipuna1
Explain the differences between public, protected, private and internal.  1
How do you write a program which produces its own source code as its output?  3
To what value do nonglobal variables default? 1) auto 2) register 3) static  4
what is the output of the following program? main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }  7
ABCDCBA ABC CBA AB BA A A  1
which operator having highest precedence? a.)+ b.)++ c.)= d.)%  3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com