Web Engineer Interview Questions | Glassdoor

# Web Engineer Interview Questions

176

Web engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

Sep 23, 2011

### 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; }

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

Jun 17, 2013
 Vertically and horizontally center an element on the screen using css. 8 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%}

### 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 Demand Media was asked...

Jun 22, 2012
 Asynchronous syntax1 AnswerMust know the exact syntax

### Software Engineer (Web Developer) at Yelp was asked...

Feb 22, 2015
 An enumerator is a class with getNextObject method. It encapsulates the container. Write an enumerator. Next, write a new enumerator called chained-enumerator which is initialized by two other enumerators. Finally, how would you make it work with N enumerators. I had to write the logic for getNextObject for the most part (and any other internal state I wanted to manage).1 AnswerI was slightly taken a back initially because it sounded just too simple - but quickly gained my ground again and did pretty okay. Work yourself thru a test case first and in the end dry-run it all the way.

### Software Engineer (Web Developer) at Yelp was asked...

Feb 22, 2015
 Second question was not really a question but a very healthy session of pair programming where I was speaking and a senior developer was coding. He chose JAVA and we were creating a list data-structure (with add, count, delete) operations. The catch was that we were going to do it TDD style. So I guided him on what kind of test we can write and how to pass that test and so on. We kept doing it and in 45 minutes we had a very well tested working list data structure.1 AnswerI had previously done complete projects TDD style so I found it really fun.

### Cloud Support Engineer - Amazon Web Services at Amazon was asked...

Aug 11, 2014
 How to set up networks for several locations, such as in VA, WA, and UT. Several questions of port numbers.1 Answerbe honest for things you don't know
110 of 176 Interview Questions

More