Deloitte
10+ Dana Anand Interview Questions and Answers
Q1. How to pass data in components using Vue js and react js?
Data can be passed in components using props in Vue.js and React.js.
In Vue.js, data can be passed down to child components using props.
In React.js, data can be passed down to child components using props as well.
In Vue.js, props are defined in the parent component and passed down to the child component.
In React.js, props are passed down from parent to child components as attributes.
Q2. how to get updated content on scroll on e-commerce app?
Use infinite scrolling to fetch new content as user scrolls down the page.
Implement infinite scrolling to load more products as user scrolls down
Make AJAX calls to fetch new content from the server
Update the DOM with the new content dynamically
Q3. what is the output if u type document in console
The output will display the document object in the console.
Typing 'document' in the console will return the document object, which represents the current HTML document.
The document object provides access to the content and structure of the webpage, allowing manipulation of elements and properties.
Q4. Hoisting concept with examples and guess the output
Hoisting is a JavaScript mechanism where variable and function declarations are moved to the top of their containing scope.
Variable declarations are hoisted but not their initializations.
Function declarations are fully hoisted.
Example: console.log(myVar); var myVar = 10; // Output: undefined
Example: console.log(myFunc()); function myFunc() { return 'Hello!'; } // Output: Hello!
Q5. What are semantic elements in HTML?
Semantic elements in HTML provide meaning to the content, making it easier for search engines and screen readers to interpret.
Semantic elements are HTML tags that clearly define the content they wrap.
They provide structure and meaning to the content, making it more accessible and SEO-friendly.
Examples include <header>, <footer>, <nav>, <article>, <section>, <aside>, <main>, <figure>, <figcaption>.
Q6. How to share data in components react
Data can be shared between components in React using props, context, or state management libraries like Redux.
Use props to pass data from parent to child components
Use context to share data across multiple components without passing props manually
Use state management libraries like Redux to manage global state and share data between components
Q7. what are closures with examples ?
Closures are functions that have access to their own scope, as well as the scope in which they were defined.
Closures allow functions to access variables from their outer function even after the outer function has finished executing.
Closures are commonly used in event handlers and callbacks.
Example: function outerFunction() { let outerVar = 'I am outer'; return function innerFunction() { console.log(outerVar); }; }
Q8. What is DOM, what is the use of that
DOM stands for Document Object Model, it is a programming interface for web documents. It represents the structure of a document as a tree of objects.
DOM is used to interact with HTML and XML documents in a structured way
It allows developers to manipulate the content, structure, and style of a website dynamically
DOM provides methods and properties to access and modify elements on a web page
Example: document.getElementById('myElement') allows you to access an element with a sp...read more
Q9. Map functionality with a call back function
Using map function to apply a callback function to each element in an array
Map function is used to iterate over an array and apply a callback function to each element
The callback function can perform operations on each element and return a new value
Example: arr.map(item => item * 2) will double each element in the array
Q10. How to handle error in javascript
Error handling in JavaScript involves using try-catch blocks, throwing custom errors, and using error objects.
Use try-catch blocks to catch and handle errors
Throw custom errors using the throw keyword
Use error objects like Error, SyntaxError, TypeError, etc. for specific types of errors
Q11. Flexbox vs grid, dom, box model,
Flexbox is best for one-dimensional layouts, Grid is best for two-dimensional layouts, DOM is the structure of a webpage, Box model is the layout of elements.
Flexbox is best for creating one-dimensional layouts like navigation bars or sidebars.
Grid is best for creating two-dimensional layouts like grids of images or cards.
DOM (Document Object Model) is the structure of a webpage, representing the elements as objects.
Box model defines how elements are laid out on a webpage, in...read more
Q12. Difference between html5 and html?
HTML5 is the latest version of HTML with new features and improvements.
HTML5 supports new elements like <header>, <footer>, <nav>, <article>, <section> etc.
HTML5 supports new input types like email, url, date, range, color etc.
HTML5 supports new APIs like Geolocation, Web Storage, Web Workers, Canvas, Audio/Video etc.
Q13. Prop drilling explain in react
Prop drilling is the process of passing data through multiple levels of components in React.
Prop drilling occurs when a component needs to pass data to a deeply nested child component.
It can lead to code that is hard to maintain and understand.
One way to avoid prop drilling is by using Context API or Redux for state management.
Q14. Redux flow explain
Redux is a predictable state container for JavaScript apps.
Redux stores the entire state of an application in a single immutable object.
State changes are made by dispatching actions, which are plain JavaScript objects.
Reducers specify how the application's state changes in response to actions.
Redux flow: Action -> Reducer -> Store -> View
Q15. Explain closure
Closure is a function that retains access to variables from its parent scope even after the parent function has finished executing.
Closure allows a function to access and manipulate variables from its outer scope.
It forms a 'closed-over' scope that persists even after the outer function has finished executing.
Closures are commonly used in event handlers, callbacks, and asynchronous code.
Example: function outerFunction() { let outerVar = 'I am outer'; return function innerFunc...read more
More about working at Deloitte
Interview Process at Dana Anand
Top Front end Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month