JavaScript Interview Questions for Freshers





What is JavaScript, really ?

JavaScript ("JS" for short) is a full-fledged dynamic programming language that, when applied to an HTML document, can provide dynamic interactivity on websites. It was invented by Brendan Eich, co-founder of the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation.

JavaScript is incredibly versatile. You can start small, with carousels, image galleries, fluctuating layouts, and responses to button clicks. With more experience, you'll be able to create games, animated 2D and 3D graphics, comprehensive database-driven apps, and much more!

*For online documentation on JavaScript , refer the doc of creators - mdn

**For the best class-room training on JavaScript at Mumbai connect with Rocky Sir

Leaving out the very simple and basic Interview Questions, at what questions do the fresh web developers get stuck ?  Here is a list :

1. Before-the-first-Round-of-JavaScript-Interview-Questions

      download a short and sweet PDF



2. 10-common-JavaScript-interview-questions (Click on the Question for viewing the answer)



3. Step-by-step solution for step counting using recursion

step counting _sctpl
For example, if you wanted to climb 4 steps, you can take the following distinct number of steps:

1) 1, 1, 1, 1
2) 1, 1, 2
3) 1, 2, 1
4) 2, 1, 1
5) 2, 2

So there are 5 distinct ways to climb 4 steps. We want to write a function, using recursion, that will produce the answer for any number of steps



4. Determine overlapping numbers in ranges

You will be given an array with 5 numbers. The first 2 numbers represent a range, and the next two numbers represent another range. The final number in the array is X. The goal of your program is to determine if both ranges overlap by at least X numbers. For example, in the array [4, 10, 2, 6, 3] the ranges 4 to 10 and 2 to 6 overlap by at least 3 numbers (4, 5, 6), so your program should return true.






5. Find all duplicates in an array



This is a common interview question where you need to write a program to find all duplicates in an array. The elements in the array have no restrictions, but in this algorithm we'll work specifically with integers. Finding duplicates in an array can be solved in linear time by using a hash table to store each element as we pass through the array. The general algorithm is: 

(1) Loop through the array
(2) At each element check if it exists in the hash table, which has a lookup of O(1) time
(3) If the element exists in the hash table then it is a duplicate, if it doesn't exist, insert it into the hash table, also O(1)




6Two sum problem


The two sum problem is a common interview question, and it is a variation of the subset sum problem. There is a popular dynamic programming solution for the subset sum problem, but for the two sum problem we can actually write an algorithm that runs in O(n) time.

The challenge is to find all the pairs of two integers in an unsorted array that sum up to a given S. For example, if the array is [3, 5, 2, -4, 8, 11] and the sum is 7, your program should return [[11, -4], [2, 5]] because 11 + -4 = 7 and 2 + 5 = 7.



7. Stock maximum profit

You will be given a list of stock prices for a given day and your goal is to return the maximum profit that could have been made by buying a stock at the given price and then selling the stock later on. For example if the input is: [45, 24, 35, 31, 40, 38, 11] then your program should return 16 because if you bought the stock at $24 and sold it at $40, a profit of $16 was made and this is the largest profit that could be made. If no profit could have been made, return -1.

for-complete-solution-to-Stock-maximum-profit


Comments

Post a Comment

Popular posts from this blog

PPC - SomeOne SpenDing - SomeOne EarNing

Web scrapping tools,Sooo Muuch Data - Analysis Needed !

Must kNow Web Dev toolS - 2OI7