DEV Community

Fatima Alam
Fatima Alam

Posted on

RockLane - Interview Questions

Q1. Tell me about yourself
Q2. A challenging task that you faced at work

Q3. Predict the output

console.log("Start");

setTimeout(() => {
  console.log("Timeout 1");
}, 0);

Promise.resolve()
  .then(() => {
    console.log("Promise 1");
  })
  .then(() => {
    console.log("Promise 2");
  });

setTimeout(() => {
  console.log("Timeout 2");
}, 0);

console.log("End");

//Start
//End
//Promise 1
//Promise 2
//Timeout 1
//Timeout 2
Enter fullscreen mode Exit fullscreen mode

Q4. Flatten this array

const flattenArray = (arr) => {
  return arr.reduce((acc, val) => {
    if (Array.isArray(val)) {
      acc.concat(flattenArray(val));
    } else {
      acc.concat(val, []);
    }
  });
};

const arr = [1, 2, [3, 4], 5, [[[6, 7], 8, [[[[9]]]]]]];
const flatten = (arr) => {
  let flattenedArr = flattenArray(arr);
  console.log(flattenedArr);
};
Enter fullscreen mode Exit fullscreen mode

Q5. Difference between useMemo() and useCallback()
Q6. Why do we use keys in react?
Q7. Server side Rendering V/S Client Side Rendering.
Q8. How to center a display flex?
Q9. What is the difference between absolute and relative positioning?
Q10. Do you use version control. If yes what all commands you know.
Q11. Do you know rebase?

Top comments (0)