Add office photos
Premium Employer

Zepto

3.6
based on 882 Reviews
Filter interviews by

10+ Swiss Pac Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. What is denbouncer and throttle

Ans.

Debouncer and throttle are techniques used to limit the frequency of function calls.

  • Debouncing delays the execution of a function until a certain amount of time has passed without the function being called again.

  • Throttling limits the frequency of function calls to a certain rate, executing the function at fixed intervals.

  • Debouncing is useful for events that may be triggered multiple times in quick succession, such as resizing a window.

  • Throttling is useful for events that need...read more

View 1 answer

Q2. Major difference between class based components and class based components

Ans.

There is no difference between class based components and class based components.

  • There seems to be a typo in the question.

  • Assuming the question is about functional components vs class components, the major difference is that class components use a class to define the component while functional components are defined as functions.

  • Class components have access to lifecycle methods while functional components do not.

  • Functional components are simpler and easier to read and write.

  • E...read more

View 3 more answers

Q3. What is the problem with colosures

Ans.

Closures can cause memory leaks if not handled properly.

  • Closures can hold references to variables outside of their scope, preventing them from being garbage collected.

  • If closures are used excessively or not released properly, they can cause memory leaks.

  • To avoid memory leaks, make sure to release closures when they are no longer needed.

Add your answer

Q4. How to do deep copy ?

Ans.

Deep copy creates a new object with the same values as the original object.

  • Use Object.assign() method to create a deep copy of an object.

  • For nested objects, use recursion to copy all levels.

  • For arrays, use slice() method to create a new array with the same values.

  • Avoid using spread operator for deep copy as it only creates a shallow copy.

Add your answer
Discover Swiss Pac interview dos and don'ts from real experiences

Q5. What is promise.all()

Ans.

promise.all() is a method that takes an array of promises and returns a new promise that resolves when all promises in the array have resolved.

  • It is used to handle multiple asynchronous operations simultaneously.

  • If any of the promises in the array rejects, the returned promise will be rejected with the reason of the first rejected promise.

  • The resolved values of the promises are returned as an array in the same order as the input promises.

View 1 answer

Q6. What is closure in javascript

Ans.

Closure is a function that has access to its parent scope even after the parent function has returned.

  • Closure allows for private variables and functions in JavaScript.

  • It is created when a function returns another function.

  • The inner function has access to the outer function's variables and parameters.

  • Example: function outer() { let x = 10; return function inner() { console.log(x); } }

  • The inner function can access and modify the value of x even after outer() has returned.

Add your answer

Q7. What is curry function

Ans.

Currying is a technique of transforming a function that takes multiple arguments into a sequence of functions that each take a single argument.

  • Currying allows partial application of a function

  • It helps in creating reusable functions

  • Curried functions are easier to compose and chain

  • Example: const add = (a) => (b) => a + b; add(2)(3) returns 5

Add your answer

Q8. What is memoization?

Ans.

Memoization is a technique of caching the results of a function to improve performance.

  • Memoization is used to avoid redundant calculations by storing the results of a function and returning the cached result when the same inputs occur again.

  • It is commonly used in recursive functions and functions with expensive computations.

  • Memoization can be implemented manually or by using libraries like Lodash or Memoizee.

  • Example: Memoizing a Fibonacci function can significantly improve it...read more

Add your answer

Q9. Implement curry function

Ans.

Curry function is a higher-order function that allows partial application of arguments.

  • Currying transforms a function that takes multiple arguments into a series of functions that take one argument each.

  • It returns a new function until all the arguments are received and then executes the original function.

  • Example: const add = (a, b) => a + b; const curriedAdd = curry(add); curriedAdd(2)(3) returns 5.

Add your answer

Q10. Shallow copy vs deep copy

Ans.

Shallow copy only copies the reference to an object while deep copy creates a new object with a new memory address.

  • Shallow copy is faster and uses less memory than deep copy.

  • In shallow copy, changes made to the original object will reflect in the copied object as well.

  • Deep copy creates a completely new object with its own memory space.

  • In JavaScript, arrays and objects are assigned by reference, so a shallow copy will only copy the reference to the original object.

  • In Python, y...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Front end Developer Interview Questions from Similar Companies

3.9
 • 15 Interview Questions
3.0
 • 14 Interview Questions
4.1
 • 13 Interview Questions
5.0
 • 11 Interview Questions
3.6
 • 11 Interview Questions
3.8
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter