Microsoft Interview Question Software Engineer / Developers

  • microsoft-interview-questions
    0
    of 0 votes
    12
    Answers

    recursive function for strlengh

    - Anonymous on October 06, 2010 Report Duplicate | Flag
    Microsoft Software Engineer / Developer Algorithm



Comment hidden because of low score. Click to expand.
0
of 0 vote

int strlength(char* s)
{
 static int i = 0; 
 if (s == NULL) return 0;
 if (s[i] == '\0') return 0;
 i++;
 return 1 + strlength(s);

}

- S on October 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int strlength(char * ptr){

if(ptr == null || *ptr == '\0')
return 0

return (1 + strlength(++ptr));

}

- eName on October 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int strlength(char * ptr){

if(ptr == null || *ptr == '\0')
return 0

return (1 + strlength(++ptr));

}

- ekapilcl on October 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int strlength(char *s){
	++s;
	return ((s[0]=='\0')?1:(1 + strlength(s)));
}

- chennavarri on October 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int xStrLen(char * str)
{
if(!(*str))
return 0;

int res = xStrLen(++str) + 1;

return res;
}

- Anonymous on October 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int xStrLen(char * str)
{
if(!(*str))
return 0;

int res = xStrLen(++str) + 1;

return res;
}

- Anonymous on October 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int Stringreverse(char * s)
{
if(*s == '\0')
return 0;
else
return 1+ Stringreverse(++s);

}

- Ashish Tickoo on October 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int strlength(char* s)
{

if(s == NULL)
return 0;

int count = 0 ;
count = 1+ strlen(s+1);
return count;
}

- Santosh Naidu on October 26, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int strlenrec(char *str)
{
if(*str=='\0')
return 0;
else
return(1+strlenrec(++str));
}

}

- geeks on July 24, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Is this possible in C# ?

- Test on August 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

What kind of a dumb question was that? Of course its possible in C#. Recursion is a a concept, it has nothing to do with the programming language !

- Rahul Arakeri on September 08, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int get_strlen(char *p)
{
  return *p=='\0'?0:(1+get_strlen(p+1));
}

- Rahul Arakeri on September 08, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book walking you through every aspect of getting a job at a top tech company, while focuses on software engineering interviews.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More