Robosoft Technologies
Amazon Interview Questions and Answers
Q1. Javascript is multi threaded or single threaded?
Javascript is single threaded.
Javascript has a single call stack and event loop.
It can handle asynchronous operations through callbacks and promises.
Web workers can be used for multi-threading in Javascript.
Q2. What is prototype in javascript?
Prototype is a property of an object that allows adding new properties and methods to an existing object.
Prototype is a blueprint for creating objects.
It is used to add new properties and methods to an existing object.
All objects in JavaScript have a prototype property.
The prototype property is used to share properties and methods between objects.
Modifying the prototype of an object affects all instances of that object.
Q3. Reverse an array, get substring, eliminates 0 from array
Reverse array, get substring, remove 0s
Use array.reverse() to reverse the array
Use string.substring() to get a substring
Use array.filter() to remove 0s from the array
Q4. What is event loop?
Event loop is a mechanism that allows JavaScript to perform non-blocking I/O operations.
Event loop is a part of JavaScript runtime that continuously checks the call stack and the task queue.
It executes the tasks in the task queue one by one, and once the task is completed, it is removed from the queue.
Event loop ensures that the JavaScript code does not block the main thread and allows for asynchronous programming.
Examples of asynchronous operations that use event loop are se...read more
Q5. Explain the concept of Virtual DOM
Virtual DOM is a lightweight copy of the actual DOM that allows for efficient updates and rendering in web applications.
Virtual DOM is a concept used in frameworks like React to improve performance by minimizing direct manipulation of the actual DOM.
When changes are made to the virtual DOM, a comparison is done with the actual DOM to identify the minimal updates needed, reducing re-renders.
This approach helps in optimizing rendering speed and improving user experience in web ...read more
Q6. Difference between var and let
var is function-scoped while let is block-scoped.
var declarations are hoisted to the top of their scope while let declarations are not.
var can be redeclared in the same scope while let cannot.
let is preferred over var for better code readability and avoiding unexpected behavior.
Example: var x = 10; if (true) { var x = 20; } console.log(x); // Output: 20 let y = 10; if (true) { let y = 20; } console.log(y); // Output: 10
Interview Process at Amazon
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month