Web Engineer Interview Questions | Glassdoor

# Web Engineer Interview Questions

244

Web engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Web Development Engineer at Amazon was asked...

May 24, 2009
 How would you implement integer division if your language did not offer it. 5 Answershttp://www.bearcave.com/software/divide.htm#Assumes positive numbers def divide(num, divide_by) answer = 0 return answer if divide_by == 0 while(num >= divide_by) num = num - divide_by answer = answer + 1 end answer end puts divide(10,0)I think this is all you need, as the question asks for integer division I.e. 2 integer inputs to provide integer output 3 / 4 = 0 (dividend is less than the divisor) 2 / 1 = 2 (divisor is 1) 4 / 2 = 2 (divisor is a factor) 7 / 5 = 1 (dividend is greater than divisor) Note: solution below is for positive integers public static double divide(int dividend, int divisor) { int remainder = dividend; int count = 0; while (remainder > divisor) { remainder -= divisor; count++; } return count; }Show More ResponsesEDIT: To also handle divide by zero and negative numbers public static int divide(int dividend, int divisor) throws ArithmeticException{ int remainder = dividend; int count = 0; if (divisor == 0) { throw new ArithmeticException("Divide by 0"); } if (remainder > 0 && divisor = divisor) { remainder -= divisor; count--; } } else if (remainder 0) { remainder *= -1; while (remainder >= divisor) { remainder -= divisor; count--; } } else if (remainder = divisor) { remainder -= divisor; count++; } } else { while (remainder >= divisor) { remainder -= divisor; count++; } } return count; }Simpler version (assuming you are allowed to use multiplication), just compute the sign at the end and multiply: function divide(a, b){ if(b == 0) throw "Cannot divide by zero"; var remainder = Math.abs(a); var dividend = Math.abs(b); var result = 0; while(remainder >= dividend){ result++; remainder -= dividend; } if(result > 0 && a*b < 0) result *= -1; return result; }

Sep 23, 2011

### Web Development Engineer at Amazon was asked...

Jun 17, 2013
 Vertically and horizontally center an element on the screen using css. 9 Answers#center{ width: 100px; height: 50px; position: absolute; left: 50%; top: 50%; }wrong answer. u need to also margin it negative#center{width: 100px; height: 50px; position: fixed; top: 0; left: 0; right: 0; bottom: 0; margin: auto;}Show More Responses#center{ width: 100px; height: 50px; position: fixed; left: 50%; top: 50%; margin-top: -25px; margin-left: -50px; }Flexbox. Flexbox is the answer. If you need older browser support you can make it happen with faking-table layout using CSS "display: table;", you can then use the "vertical-align" property. .centered-content { display: flex; align-items: center; justify-content: center; box-sizing: border-box; } .centered-content .centered-item { max-width: 50%; /* Really only here to not max-out the horizontal centering effect. */ box-sizing: border-box; }. container{ Position : absolute; Width : 200px; Top : 50℅; Left : 50℅; Transform : translate(-50℅) }
div { width: 100px; height : 100px; background: #d0d0d0; position: absolute; top: 50%; left: 50%; transform : translate(-50%, -50%); }
#centre {margin : 0 auto; width:100%;height:100%}parent_of_element { display: flex; width: 100vw; height: 100vh; } element { margin: auto; }

### Engineer - QCS Server Web Applications Development at Qualcomm was asked...

Jan 26, 2011
 How to discover if the given number is Power of 2 ? 4 Answers10=2 100=4 1000=8… Caught the thing .. he didn't like my implementation. don't be nervous!return (( x!=0) && (x & (x -1) == 0)) a number which is power of two will have single 1 in binary representation ex. 16 00010000 x-1 will have pattern 00001111 hence x&(x-1) will always be 0 for power of two numbers. Need to check condition for x!=0 since 0 is not a power of two. Special case to handle.if you can figure this out inside an hour, congratulations this isnt something that should be in an interview to be honest the level of difficulty of the answer that algo came up with is at the level of an upper division course that has a proof of it written in wikipedia i honestly like the brute force solutionShow More ResponsesDivide the number by 2, and repeat, until the result is a not an integer number (in this case is not a power of 2) or the result is 1 (in this case the number was a power of 2).

### Engineer - QCS Server Web Applications Development at Qualcomm was asked...

Jan 26, 2011
 Binary tree , left node has smallest value . Print 5 10 20 25 and then “count of nodes=4”… 2 Answersrecursion ... defined "current=head" in the method so it doesn't changes ofcourse, even if I sent current.next in recursion... don't be nervous!Did not get this question? Could you please eleborate it more?

### Manager of Web Engineering at AutoNation was asked...

Jun 28, 2010
 How do would you handle a totally demoralized team and bring them back?3 AnswersIt all depends on the individuals and why they are demoralized.Give them team tasks that are acheivable and review the performance.Meet with them as a group, and work towards a "reset"; a break from tomorrow being exactly the same as yesterday. Schedule meetings with each team member individually. Ask their concerns. Learn, individually, why they're demoralized. Give them a path forward that avoids or mitigates some of the negatives. Be absolutely realistic; don't stretch the truth or lie, but give them an honest path to where they'd rather be. In parallel, likely ramp up hiring, as you're not often getting through that with the entire team intact.

### Senior Web Applications Engineer at Leaf Group was asked...

Jun 22, 2012
 Asynchronous syntax1 AnswerMust know the exact syntax

### Web Development Engineer at Amazon was asked...

Feb 25, 2012
 A simple CSS positioning question that starts with an independent widget (like a start rating widget)1 AnswerThey will evolve and complete it till you start breaking and loosing it to see how far they can push you.

### Web Development Engineer at Amazon was asked...

Feb 25, 2012
 Write a JS code to travers the DOM and find an element with a specified class name1 AnswerStart simple. They will try to push you to optimize it (O(n) vs O(log n), recursive etc). Be aware of edge cases. Depthvs breadth)

### Software Engineer - Web at The Zappos Family was asked...

Oct 1, 2013
 Design program that, utilizing the Zappos API, downloads images based on SKU values.1 AnswerUse the API key they give you and read the Zappos API documentation to figure it out. A lot easier done if you read the documentation before hand.
110 of 244 Interview Questions