React JS Coding Round
- In incognito mode, if you open a site like Amazon.com or Flipkart.com, what are some ways to optimize the page's load speed?
- Is JavaScript single-threaded or multi-threaded? What is the event loop? Does JS execute top to bottom, or the other way around?
- If you fetch 10M records via an API in JS and render them in a table in the UI, what problems show up in the UI? How would you solve them?
- What's the output of the following code?
for (var i = 0; i < 10; i++) {
setTimeout(() => {
console.log(i)
}, 0)
}
- What's the difference between the
varandletkeywords in JS? - What are closures in JS? Give an example.
- What is the Temporal Dead Zone in JS?
- Implement a collapsible/expandable component with +/- buttons, given this data structure:
const data = {
"id": 1,
"name": "Root",
"children": [
{
"id": 2,
"name": "Child 1",
"children": [
{
"id": 3,
"name": "Child 1.1"
},
{
"id": 4,
"name": "Child 1.2"
}
]
},
{
"id": 5,
"name": "Child 2"
}
]
};
- What's the difference between
setTimeoutandsetInterval? - What does the
deferattribute do in HTML? Can it be used on animgtag?
Java Coding Round
- Given an undirected graph with n nodes (labeled 0 to n - 1) and an edge list edges, where edges[i] = [u, v] represents an undirected edge between node u and node v.
Determine whether the graph can be colored using exactly 2 colors such that no two adjacent nodes share the same color. Return true if it can, false otherwise.
Discussion
Loading comments…