HCLTech
10+ Perficient Interview Questions and Answers
Q1. What is Event Loop ? How it works?
Event Loop is a mechanism in JavaScript that manages the execution of code and handles asynchronous operations.
Event Loop continuously checks the call stack and the message queue.
If the call stack is empty, it takes the first message from the queue and pushes it onto the call stack.
If the message is a callback function, it is executed and removed from the call stack.
If the message is not a callback function, it is passed to the relevant API for execution.
Once the API has fini...read more
Q2. How to handle state in functional components.
State in functional components can be managed using the useState hook in React.
Use the useState hook to declare state variables in functional components.
useState returns an array with the current state value and a function to update that value.
Example: const [count, setCount] = useState(0);
State variables should be immutable, so always use the setter function to update them.
Q3. javascript promise method
JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation.
Promises are used to handle asynchronous operations such as fetching data from an API.
They have three states: pending, fulfilled, or rejected.
Promises can be chained using .then() and .catch() methods.
Promises can also be created using the Promise constructor.
Q4. What is event loop in javascript.
Event loop in JavaScript is responsible for handling asynchronous operations by executing callback functions in a non-blocking way.
Event loop is a mechanism that allows JavaScript to perform non-blocking operations.
It continuously checks the call stack and the callback queue to see if there are any functions that need to be executed.
If the call stack is empty, it takes the first function from the callback queue and pushes it onto the call stack for execution.
This process allo...read more
Q5. Make a set of 6 boxes Responsive in CSS
Use CSS to make a set of 6 boxes responsive
Use percentage or viewport units for width and height
Use media queries to adjust styles for different screen sizes
Consider using flexbox or grid for layout
Avoid using fixed pixel values
Test on different devices and browsers
Use CSS frameworks like Bootstrap or Foundation for easier implementation
Q6. Write a program 1 to 100 prime numbers
Generate an array of prime numbers from 1 to 100.
Iterate from 1 to 100 and check if each number is prime
A prime number is only divisible by 1 and itself
Start with a list of prime numbers and check divisibility
Q7. What is hosting in Javascript
Hosting in JavaScript refers to the process of declaring a variable or function before it is used in the code.
Hosting allows you to use variables and functions before they are declared in the code.
Variables are hoisted to the top of their scope, while functions are fully hoisted.
Example: console.log(myVar); var myVar = 10; This will not throw an error because 'myVar' is hoisted to the top of the scope.
Q8. What is mean by dom
DOM stands for Document Object Model, which is a programming interface for web documents.
DOM is a representation of the structure of a web page, allowing scripts to dynamically access and update the content, structure, and style of the document.
It provides a way for scripts to interact with the web page by accessing and manipulating elements like text, images, forms, etc.
DOM is platform and language-independent, allowing developers to use it with any programming language that...read more
Q9. Explain promise in typescript
Promises in TypeScript are objects representing the eventual completion or failure of an asynchronous operation.
Promises are used to handle asynchronous operations in a more readable and manageable way.
They can be in one of three states: pending, fulfilled, or rejected.
Promises can be chained using .then() to handle success and .catch() to handle errors.
Example: const myPromise = new Promise((resolve, reject) => { ... });
Q10. Explain hooks in javascript
Hooks in JavaScript are functions that let you use state and other React features without writing a class.
Hooks were introduced in React 16.8 to allow functional components to have state and lifecycle methods.
useState() is a hook that allows you to add state to functional components.
useEffect() is a hook that allows you to perform side effects in functional components.
Custom hooks are functions that allow you to reuse stateful logic across multiple components.
Q11. Reverse the string
Reverse a given string
Use built-in methods like split(), reverse(), and join() to reverse the string
Alternatively, loop through the string from end to start and build a new reversed string
Interview Process at Perficient
Top Front end Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month