NetApp Interview Question for Software Engineer / Developers






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

What i can think of is such an API would be copying data from src to target location in units of byte size each ( I mean one byte at a time).

Since it can work for any type of data the signature should be that of a void pointer. Now it seems trivial. (ofcourse to keep validations in place we should be aware of what memcpy does, what does it return etc..)

Anyone with any distinguishable ideas/facts.

- hary February 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Go wrong because src and dst overlap?

- Lei February 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What if the memory regions overlapped?

- - February 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use memmove during overlap ... it will ensure that destination has proper content at the end of copy but src can be garbled

- Janus March 14, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

//Not exactly ideal, for overlapping src and dest, memmove() is always safer
int mymemcpy(void *dest, void *src, int nbytes)
{
      int i;
      if(dest==src) return 0;
      if(src>dest)
            for(i=nbytes-1; i>=0; i--) dest[i] = src[i];
      else
            for(i=0; i<nbytes; i++) dest[i] = src[i];
}

- Anonymous October 17, 2011 | Flag Reply


Add a Comment
Name:

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

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

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