Facebook

  www.facebook.com
  www.facebook.com

Interview Question

Production Engineer Interview Menlo Park, CA

For a given set of software checkins, write a program that

  will determine which part along the branch where the fault lies.
Answer

Interview Answer

3 Answers

1

first, design a test case to detect the failure.
next, determine the last known "good" state of the software, i.e. the revision number of the last known "good" state.
now, write a script that will check out each subsequent revision starting from the known good revision, build, run the test case and examine the output.
When output fails, you can determine the revision at which the bug was introduced.

Anonymous on Nov 28, 2012
2

A - array of versions, |A| = n
check(A[0]) = true - first version is fine
check(A[n-1]) = false - last version has the fault

binary search:

int start = 0;
int end = n-1;
while(end-start>1){
 int middle = (end+start)/2;
 if (check(A[middle])) start = middle;
 else end = middle;
}

A[end] is the version with the fault

Anonymous on Feb 7, 2013
0

I would write an integration test, for that scenario which started to fail. Then I'd write a shell script which would run that test over some amount of last revisions. Once test is failed, you've found a revision where mistake was made.

holms on Aug 19, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.