# 12K

Web Engineer interview questions shared by candidates

## Top Interview Questions

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

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

const Sum = a =&gt; b =&gt; c =&gt; 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

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

#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

### 1) Clustered and Non Clustered (SQL)?

What other types questions were on the written test?

Given a scnerio, create a database model

How to improve performance?

### 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 {,[,(

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

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

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?

### 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.

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

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

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 &lt; Array1.length; i++) { if (!hash[Array1[i]]) { hash[Array1[i]] = 1; } } for (let i = 0; i &lt; 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 &lt; arr1.length; i++ ) { dict[arr1[i]] = 1; } for (i = 0; i &lt; arr2.length; i++ ) { if (dict[arr2[i]]) { duplicates[arr2[i]] = arr2[i]; } } return Object.values(duplicates); } Less

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

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

### What is a JavaScript callback function?

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