Webito Infotech
Grab Greco Interview Questions and Answers
Q1. How to pause process for particular code response using javascript?
You can pause a process in JavaScript using the setTimeout function.
Use setTimeout function to delay the execution of a code block.
Specify the time in milliseconds for the delay.
Example: setTimeout(() => { console.log('Paused for 2 seconds'); }, 2000);
Q2. What is difference between useMemo and useCallback?
useMemo is used to memoize a value, while useCallback is used to memoize a function.
useMemo is used to memoize a computed value and recompute only when its dependencies change.
useCallback is used to memoize a callback function and re-create it only when its dependencies change.
useMemo is useful for optimizing performance by avoiding unnecessary re-computations.
useCallback is useful for optimizing performance by avoiding unnecessary re-creations of callback functions.
Q3. Differenece between null and undefined in javascript?
Null represents an intentional absence of any value, while undefined represents a variable that has been declared but not assigned a value.
Null is explicitly assigned to a variable to indicate that it has no value.
Undefined is the default value for variables that have been declared but not initialized.
Null is a primitive value, while undefined is a type.
Null is used to represent an empty value, while undefined is used to represent an uninitialized value.
Example: let x = null;...read more
Q4. Explain lifecycle of function component using useEffect
useEffect is a hook in React that allows for side effects in function components.
useEffect is used to perform side effects in function components.
It runs after every render by default.
It can be used to fetch data, subscribe to events, or update the DOM.
To mimic componentDidMount, pass an empty array as the second argument.
To mimic componentDidUpdate, pass a variable or state that useEffect depends on.
Q5. How to replace $ in jquery
Use the .replace() method in JavaScript to replace $ in jQuery
Use the .replace() method in JavaScript to replace $ with another character or string
Example: var str = 'jQuery is $ great'; str = str.replace('$', 'not'); // Output: 'jQuery is not great'
Q6. Difference between let,var,const?
let is block scoped, var is function scoped, const is a constant variable.
let is block scoped, meaning it is only accessible within the block it is declared in.
var is function scoped, meaning it is accessible throughout the function it is declared in.
const is a constant variable, its value cannot be reassigned once it is initialized.
Q7. Truthy and falsy valueof javascript?
Truthy values are values that evaluate to true in a boolean context, while falsy values are values that evaluate to false.
Truthy values include non-empty strings, numbers other than 0, true boolean values, and objects.
Falsy values include empty strings, the number 0, false boolean values, null, undefined, and NaN.
Using double negation (!!value) is a common way to convert a value to its corresponding boolean representation.
Q8. What is react js?
React JS is a JavaScript library for building user interfaces.
React JS is a declarative, efficient, and flexible JavaScript library for building user interfaces.
It allows developers to create reusable UI components.
React uses a virtual DOM to improve performance by updating only the necessary parts of the actual DOM.
React follows a unidirectional data flow, making it easier to understand and debug.
React can be used to build single-page applications, mobile apps, and even desk...read more
Q9. C language 2 pattern of digits
The question is asking for two patterns of digits in the C language.
Use nested loops to iterate through all possible combinations of digits.
Check for the desired patterns within the nested loops.
Example: Pattern 1 - 1234, Pattern 2 - 5678
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month