Web intern Interview Questions

17K

Web Intern interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Amazon
Web Development Engineer was asked...February 25, 2017

Implement Sum(3)(4)(5)=12 with javascript

17 Answers

const Sum = a => b => c => a + b + c;

``` // Lexically nested function definitions defined within enclosing function function Sum(arg0) { function Inner1(arg1) { function Inner2(arg2) { return arg0 + arg1 + arg2; } return Inner2; } return Inner1; } console.log(Sum(3)(4)(5)); ``` Less

var sum=0; // global variable function Sum(num){ sum=num+sum; return Sum; } Sum(3)(4)(5); Less

Show more responses
Amazon

Vertically and horizontally center an element on the screen using css.

8 Answers

#center{width: 100px; height: 50px; position: fixed; top: 0; left: 0; right: 0; bottom: 0; margin: auto;} Less

wrong answer. u need to also margin it negative

. container{ Position : absolute; Width : 200px; Top : 50℅; Left : 50℅; Transform : translate(-50℅) } Less

Show more responses
Americaneagle.com

1) Clustered and Non Clustered (SQL)?

7 Answers

What are the other questions they ask ? Related to programming

Given some queries asked you to find where the clustered index or non clustered indexes are focused. This is what all I remember, and after that they ask you to demo your prev project on your laptop and few questions related to that and the written test. Less

Can you tell the exact questions they asked you in onsite? What Programming questions? What follow up questions after demo? What areas to focus to be successful and get offer? Less

Show more responses
Google

1) Given a string of parantheses, check if the string is valid. ex: [[]] is valid, ][][ is not valid. How would you solve if the parantheses could be of different types like {,[,(

6 Answers

Use a counter to track the status. Stack solution is no difference from this. Seeing an opening parenthesis increment the counter. Seeing a closing parenthesis decrement the counter. Check the counter is always non-negative. Counter has to be zero when string ends. Less

Stack the parenthesis up. 1st of course the first parenthesis will go on to the stack. If you see a closing parenthesis, pop the stack and see if the parenthesis matches the one which is just read(closing one), if no match? error else keep going. Less

To Aegis: If you take "[" as 1 and "]" as -1, then ][][ starts from -1. We can say that's invalid right away. Less

Show more responses
MountBlue Technologies

Print patterns like Swastic sign, 2-D Array manipulations(Bit Difficult) and String manipulations.

6 Answers

They will mail the exact date. The joining date is between 6-16 aug. The difficulty of 2nd round was medium. One question was a bit difficult and the rest were medium.If you are good at coding and regularly doing it then you can easily crack it. Less

Be sure you are good at coding.

when is your joining??what is the difficulty of 2nd round?

Show more responses
Spotify

You have 1000 computers. Each computer contains a text file containing 1 billion floating point numbers. Design an algorithm or algorithms for extracting the top 1000 numbers from the entire list. Describe in detail how long it would take to process and why.

6 Answers

1. 1000 computers - parallel 2. the problem can be divided into 2 parts. (1) find the top 1000 numbers from that 1 billion numbers in one computer To do this. we just need to use merge sort. Everytime use the left part. With some calculation, the solution for this is actually O(N). n is 1 billion. (2) get that top 1000 from the 1k * 1k list. (easy) Less

There is a very nice parallel sorting algorithm with a very good iso-effeciency. It is called Sample-sorting. I would use that. Less

You could do a bunch of crazy stuff too... Map reduce and parallel stuff is kinda a given. You'd be reading in strings, so before converting them to numbers, you could just check the position of the comma/point, and skip if your comma/point counter is at a higher value. If there's a minus sign in the beginning ignore the number, provided you already have 1000 positive numbers. Do something crazy with a stream and a router. Write a HD driver that scans the sign bit and exponent bits. lol Find a way to scan vertically for the comma/point. And you wouldn't be sorting you'd be searching. Ideally, it would take as long as it takes to read 1 text file from disk, because you'd be kinda faux streaming it through your code, plus a little extra time, multiplied by the number of files. You'd get a nice boost from dividing your file by the number of processors. 32 cores = 32 pieces of file being processed at the same time. Less

Show more responses
Amazon

Take two arrays and compare them to find duplicates. Only list each duplicate once.

6 Answers

The most upvoted answer on this has a run time complexity of O(m * n) where m and n are the arrays. This is solvable in O(n) by using a hash map, by sacrificing space for complexity: var Array1 = ["a", "b", "c", "d", "e", "f", "c"]; var Array2 = ["c", "x", "y", "f", "c"]; let hash = {}; let result = []; // loop over the largest for (let i = 0; i < Array1.length; i++) { if (!hash[Array1[i]]) { hash[Array1[i]] = 1; } } for (let i = 0; i < Array2.length; i++) { if (hash[Array2[i]]) { result.push(Array2[i]); delete hash[Array2[i]]; } } console.log(result); Less

var Array1 = ["a", "b", "c", "d", "e", "f"]; var Array2 = ["c", "x", "y", "f"]; Array1 = Array1.filter(function(val) { return Array2.indexOf(val) !== -1; }); Less

I think that the last solution suggested might still return duplicates. For example if array1 = [1,2,3] and array2 = [2,2,2] we will get the result of [2,2]. This is another solution in O(n) - function findDuplicates(arr1, arr2) { var dict = {}; var duplicates = {}; for (i = 0; i < arr1.length; i++ ) { dict[arr1[i]] = 1; } for (i = 0; i < arr2.length; i++ ) { if (dict[arr2[i]]) { duplicates[arr2[i]] = arr2[i]; } } return Object.values(duplicates); } Less

Show more responses
PE International

"If you were stranded on a desert island, what three development tools would you bring with you?"

5 Answers

This ridiculous, senseless question was the first one asked. It set the tone for what was to follow. Less

IDE, Build Tools, Version Control!

Git, Codio, and Netflix

Show more responses
Bloomberg L.P.

What is a JavaScript callback function?

5 Answers

A callback function is a piece of JavaScript code that executes after the main function that the callback is attached to executes successfully. Less

udaykanth, I would say that a .forEach() would be the most common and most basic use of a callback function. I'm just writing this to help anyone that might have a hard time thinking up a quick example if the come across this question themselves. Example: var numArray = [ 1, 2, 3 ] ; numArray.forEach( function( i ) { console.log( arr[ i - 1 ] ) } ) ; // logs out // 1 // 2 // 3 Less

I don't think Bloomberg is a very good company. I am an excellent web developer and have gotten multiple offers from other companies with big names, but was rejected by Bloomberg. They are too demanding during the job interview and it becomes a game of how well you can interview as opposed to how talented an employee you are and how much you can contribute to the growth of the company. Less

Show more responses
Amazon

How would you implement integer division if your language did not offer it.

5 Answers

#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) Less

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

http://www.bearcave.com/software/divide.htm

Show more responses
Viewing 1 - 10 of 16,835 interview questions

See Interview Questions for Similar Jobs