Engineering Interview Questions in Los Angeles, CA | Glassdoor

# Engineering Interview Questions in Los Angeles, CA

6,062

Engineering interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

May 4, 2010

### Senior Mechanical Engineer I at Northrop Grumman was asked...

Apr 26, 2014
 What has been your active role in the team process you're currently working with?2 AnswersExplained details of daily involvement, software used, level of completion of initial input received, and final deliverable.I quote the repairs and write up the job router steps to include R & R parts, inspection. Testing, and FAA 8130

### Office Engineer at Clark Construction Group was asked...

May 7, 2012

Mar 10, 2010

Oct 6, 2012
 Write a function that finds the median of a set of three numbers, also find the Big O. Can it be done with only 2 comparisons, or do you need 3?11 AnswersPick two numbers: A and B, Add the third number to each of the first two : (A+C), (B+C). Compare these two numbers and take the lesser of the two. Now compare C with the other member of the less number. The greater of these two is the median.I'm not following. Is this: say, B+C is less than A+C, then the larger of B and C is the median? If so, isn't this a counterexample: A = 2, B = 1, C = 3?Actually the answer is the next one: we could have an answer using only two comparisons. The main idea is that we need to examine one of the numbers to get into the segment created by the other two numbers. And another important thing is that one comparison could be used to definitely determine for both two segments created by two numbers. For example we are trying to examine number A and we have two segments formed by B and C numbers: [B; C] and [C; B]. But considering that for determining if A is in the segment created by B an C we need to make the following comparison: (A - B) * (C - A) >= 0. It is easy to notice that if A is in segment [B; C] (B is less or equals to C) we have both multipliers are positive but in an opposite case when A is in segment [C; B] (C is less or equals to B) we have both that multipliers are negative. If former comparison is negative - then number A is not in any of segments [B; C] or [C; B]. And here is a code of function on C/C++: int medianOfThreeNums(int A, int B, int C){ if ((A - B) * (C - A) >= 0) { return A; } else if ((B - A) * (C - B) >= 0) { return B; } else { return C; } }Show More Responsesif (B-A) > 0 if (C-B) then B else C else if (C-A) > 0 then A else C a=b=c ?First get two numbers: x = a - b y = a - c now there are four possible cases for x and y if x & y are both positive => a is bigger than both b and c.=> choose bigger of b & c if x & y are both negative => a is smaller than b and c => choose smaller of b & c if x is positive and y is negative => a is bigger than b but smaller than c => choose a if x is negative and y is positive => a is smaller than b but bigger than c => choose avoid GetMedian(int a, int b, int c) { int small, large; if (a < b) { small = a; large = b;} else {small = b; large = a;} // Check where c lies: if (large < c) return large; else if (c < small) return small; else return c; }@Moy: if the answer turns out to be small, then haven't you done 3 compares?Running Vitalii's code with a = 1, b = 7, and c = 3 produces a median == 7, which is incorrect. Suggestions?Vitalii's solution works for me.def find_median(a, b, c): ab = b - a bc = c - b if -ab * (ab + bc) >= 0: return a if ab * bc >= 0: return b return ccan't you sort the 3 numbers, the median is the middle one...?

Aug 1, 2013

### Software Engineer Intern at Hulu was asked...

May 3, 2012
 Write a power function power(a , b) returns a^b8 Answersint power (double a, int b) { for (int i = 1, i <= b, i++) { a *= a; } return a; }There are some conditions you are missing. What if b is <=0 ?The conditions made by the Hulu rep was to assume b > 0. However there is a better way to do this problem.Show More Responseslong power(int a, int n) { if(n%2==0) return power(a,n/2)*power(a,n/2); else if (n%2==1&&n!=1) return power(a,n-1)*a; else //n==1 return a; }double power(int a, int n){ double res=1; while(n!=0){ if((n&1)==1) { if(n>0) res*=a; else res/=a; } a*=a; n /=2; } return res; }def power(a,b): if b is 1: return a return a * (power(a, b--))double pow(int a,int b) { if(b0) { if(b%2==1) res*=a; a*=a; b>>1; } return res }def power(a, b): return a**b

Apr 17, 2010
 Given Vcc and 2 capacitors A and B in series to ground, what is the voltage in between4 AnswersSomewhere in betweenVb=(Cb/Ca+Cb)VI mean Vb=(Cb/(Ca+Cb))VShow More ResponsesIt depends on the initial condition.... if both capacitors were discharged to 0V at first, and then one side is charged to Vcc, then the answer would be Vb=(Ca/(Ca+Cb))Vcc Vcc---Ca----Cb----gnd However since there was no initial conditions given , the middle voltage could be anything if the capacitors are ideal