Josh Technology Group
10+ MJS CO Interview Questions and Answers
Q1. Last Stone Weight Problem Explanation
Given a collection of stones, each having a positive integer weight, perform the following operation: On each turn, select the two heaviest stones and smash them together. ...read more
This question is about finding the weight of the last stone after repeatedly smashing the two heaviest stones together.
Sort the array of stone weights in descending order.
Repeatedly smash the two heaviest stones until there is at most 1 stone left.
If there is 1 stone left, return its weight. Otherwise, return 0.
Higher order functions are functions that can take other functions as arguments or return functions as their results.
Higher order functions can be used to create more flexible and reusable code.
They enable functional programming paradigms.
Examples of higher order functions include map, filter, and reduce in JavaScript.
A todo list application using localstorage.
Use HTML, CSS, and JavaScript to create the user interface.
Use the localstorage API to store and retrieve todo items.
Implement features like adding, editing, and deleting todo items.
Display the list of todo items and their status.
Allow users to mark todo items as completed or incomplete.
Hoisting is a JavaScript behavior where variable and function declarations are moved to the top of their containing scope.
Hoisting applies to both variable and function declarations.
Variable declarations are hoisted but not their initializations.
Function declarations are fully hoisted, including their definitions.
Hoisting can lead to unexpected behavior if not understood properly.
Promises in JavaScript are objects that represent the eventual completion or failure of an asynchronous operation.
Promises are used to handle asynchronous operations such as fetching data from a server or reading a file.
They simplify the process of writing asynchronous code by providing a more structured approach.
Promises have three states: pending, fulfilled, or rejected.
They can be chained together using methods like .then() and .catch().
Promises help avoid callback hell an...read more
Design a signin page using HTML and CSS only
Create a form element with input fields for username and password
Style the form using CSS to make it visually appealing
Add a submit button for users to sign in
Consider adding error messages or validation for user input
Use CSS to make the page responsive for different screen sizes
Memoization is a technique in JavaScript to cache the results of expensive function calls for future use.
Memoization improves performance by avoiding redundant calculations
It is commonly used in recursive functions or functions with expensive computations
The cached results are stored in a data structure like an object or a map
Memoization can be implemented manually or using libraries like Lodash or Memoizee
Temporal Dead Zone is a behavior in JavaScript where variables are not accessible before they are declared.
Temporal Dead Zone occurs when accessing variables before they are declared
Variables in the Temporal Dead Zone cannot be accessed or assigned
The Temporal Dead Zone is a result of JavaScript's hoisting behavior
Example: accessing a variable before it is declared will throw a ReferenceError
Arrow functions are a concise way to write functions in JavaScript.
Arrow functions have a shorter syntax compared to regular functions.
They do not have their own 'this' value.
They do not have the 'arguments' object.
They cannot be used as constructors with the 'new' keyword.
They are commonly used in functional programming and with array methods like 'map' and 'filter'.
Virtual DOM is a lightweight copy of the actual DOM that allows efficient updates and rendering in JavaScript frameworks.
Virtual DOM is a concept used in JavaScript frameworks like React.
It is a lightweight copy of the actual DOM tree.
Changes made to the virtual DOM are compared with the actual DOM to determine the minimal updates needed.
This helps in efficient rendering and improves performance.
Virtual DOM allows developers to write code as if the entire page is rendered on ...read more
IIFE stands for Immediately Invoked Function Expression. It is a JavaScript function that is executed as soon as it is defined.
IIFE is a way to create a function expression and immediately invoke it.
It helps in creating a private scope for variables and functions.
It is commonly used to avoid polluting the global namespace.
IIFE can be written using different syntaxes like using parentheses, function declaration, or arrow functions.
JSX is a syntax extension for JavaScript that allows you to write HTML-like code in your JavaScript files.
JSX stands for JavaScript XML
It is commonly used with React to define the structure and appearance of components
JSX elements are transpiled into regular JavaScript function calls
It allows you to write HTML-like code with JavaScript expressions embedded within curly braces
Example:
Hello, {name}!
Interview Process at MJS CO
Top Frontend Developer Intern Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month