Senior Engineer Interview Questions | Glassdoor

# Senior Engineer Interview Questions

8,352

Senior engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Senior Software Engineer at Amazon was asked...

Sep 3, 2011
 A list with a set of integers. All elements appear even number of times while one appear odd number of times. Find this number that appear odd number of times6 Answersuse a counter for the number of times the digit appearSuppose a list of integers: A[1..n] We can calculate the result of A[1] xor A[2] xor ....A[n] This is the answer!Use a HashSet. For each number in the list check to see if it exists in the HashSet. If it doesn't, put it in the HashSet. If it's already in the HashSet take it out. When you've gone through all the numbers the only number left in the HashSet will be the one that appeared an odd number of times.Show More Responses1. sort the numbers 2. then do what hong sun does.// Requires that all the elements appear even # times except exactly 1: int findOddEntry(List list) { int xorBuffer = 0; for (int i : list) { xorBuffer ^= i; } return xorBuffer; }adding/deleting entry into an object for every value. In the end only the key with odd occurrences will be left since all even will removed. For even, first occurrence add into object, second one remove.

Jun 7, 2010

### Senior Design Engineer at AMD was asked...

Feb 25, 2009
 In saturation, the channel region pinches off well before the drain. How does current get from the source to drain then? (Since the channel is pinched off, it does not touch the drain)3 AnswersTunnelingIts drift, there is an electric field across the depletion region, whenever an electron diffuses into the depletion region, the electric field sweeps it across the the drain, the current thus depends on the diffusion into the depeletion region rather than the electric field strength so current is relatively constant in saturation.This is an excellent question and the last answer by anonymous is very correct. I will try to elaborate further. Now, when the channel is pinched off, this is due to an extension of the depletion region between the drain and the bulk into the channel region, thus due to the large(+ve) E field from drain to source, Electrons are swept into the n+(drain) region, thus u have drift current due to this movement! Now technically speaking, whenever you have a depletion region btw the N+ and P material, the current flow contribution is not only due to Drift, you have Diffusion contribution also but is assumed negligible compared to Drift current!

Jan 16, 2013

### Senior Software Engineer at Ericsson-Worldwide was asked...

Mar 24, 2009
 I had not expected to be asked logic questions, which made me nervous. The first one was a weigh nine items on a balancing scale to find the odd one out in the fewest scale uses3 AnswersSplit them into three groups of three, weigh two to determine the odd set out, then split that stack of three into three sets of one, and weigh two to find the single one out, requiring only two scale uses.The above strategy works only if you know whether the odd item is lighter or heavier. If you do not know how it differs, you will need more scale uses.111-111-114 <--- By weighing any of two sets, you get 114. 1-1-4 <----- By weighing any of two, you can find out 4.

### Senior Software Engineer at Amazon was asked...

Apr 23, 2011
 "Given a log file spanning multiple days, and given a page transition A -> B -> C, find all the unique users who made this page transition in the logs"3 AnswersThis one was doable. But we were short on time and the manager seemed annoyed to be there.How is the transition encoded? Would a simple grep work?Unlikely. The task was do it in Java 1.6, also they had to make the entire transition A -> B -> C, not neccessarily on the same line and maybe not even on the same date. Think Standard Web Server Logs. So you get: datetime - User X gets Page A . . . (millions of lines later) datetime User X gets Page B.... (millions of lines later) datetime User X gets Page C.... You get the idea. If I give you A -> B -> C, you get "User X" as out put, because they made the transition.

### Senior Software Engineer at Amazon was asked...

Jul 17, 2010
 serialize binary tree3 AnswersDo something similar to Breadth-First-Traversal. For each node assign an integer key that should be serialized along with the nodes data. Start with 0 as key for the root. For each node with key x, push it's left child (if it exists) with key 2x+1 and it's right child (if it exists) with key 2x+2. The key uniquely identifies position of the node in the tree.Record both pre-order and mid-order sequenceDo the array representation of the tree: children at 2n and 2n+1

### Senior Systems Engineer at Yahoo was asked...

Feb 17, 2013
 If you could be any Linux command, which would you be?3 Answers"whomai" :)Was excited - correct one - "whoami"top sleep

### Senior Software Engineer at Amazon was asked...

Oct 27, 2010
 what is the bubble sort algorithm3 Answersthe alogrythm used forstandard algo Best O(n) worst O(n2) case for(int i= count; i>=0;--i) for(int j=0; j a[i+1]) swap(a[i], a[i+1]) can do swap wit xor swap a[i] = a[i]^a[i+1] a[i+1]=a[i]^a[i+1] a[i]=a[i]^a[i+1]int[] bubbleSort( int[] input ) { int swap_occurred = 1; while (swap_flag) { swap_occurred = 0; for (int i=0; i

### Senior Software Engineer at Opower was asked...

Mar 8, 2011
 Implement a queue using only stacks. 3 Answersuse 2 Stacks, stackA and stackB. when you enqueue, push the item onto stackA. When you dequeue, pop everything from stackA and push onto stack B. Pop from stackB.the above answer is incorrect. I can't figure out how to edit, so here is the corrected version: use 3 Stacks, stackA, stackB, stackC. when you enqueue, push the item onto stackA. When you dequeue, pop everything from stackB and push onto stackC, pop everything from stackA and push onto stack B, pop everything from stackC and push onto stackB. Pop from stackB.actually this is doable with 2 stacks nvm: use 2 Stacks, stackA and stackB. when you enqueue, push the item onto stackA. When you dequeue, if stackB is empty pop everything from stackA and push onto stack B. Pop from stackB
4150 of 8,352 Interview Questions