Skip to content

Instantly share code, notes, and snippets.

@akimriparian
Last active July 15, 2022 20:49
Show Gist options
  • Save akimriparian/b57cc5b774f639b07098df3c83ed6dad to your computer and use it in GitHub Desktop.
Save akimriparian/b57cc5b774f639b07098df3c83ed6dad to your computer and use it in GitHub Desktop.
On site Interview Problems
Node Modules:
How do modules work in node?
If a variable is declared at the top level and exported, what is the scope?
Databases:
What is a relational DB?
What is a Document-based DB?
What are the differences in SQL vs NoSQL?
* Strengths and weaknesses of a relational DB?
* Strengths and weaknesses of a Document DB?
What are streams in node and how do they work?
What uses cases are good for streams?
Write a function that traverses an object and returns all the strings which are numbers as Numbers. It should also traverse all the nested objects.
{
a: "1",
b "foo",
nested: {
c: "3.0"
d: 3.14159,
grandchild: {
name: "bar"
age: "5"
},
bonus: [1, "1", "2.7"]
}
}
Expected result:
{
a: 1,
b "foo",
nested: {
c: 3.0
d: 3.14159,
grandchild: {
name: "bar"
age: 5
},
bonus: [1, 1, 2.7]
}
}
Screening Interview questions that I ask
Tell me about your work experience and what you've been working on.
* look for experience relevant to our work here. Ask for more details/clarification on relevant experience
What is your most technically challenging problem that you've solved?
or similarly, what are you most proud of?
Are you more frontned UI vs backend?
Rate yourself on a scale of 1 to 10 on the following (if relevant)
* JS
* DB (postgres, mongo, mysql)
* html, css
* node.js
* Express.js
* Vue.js
* React
* Angular
Questions about Javascript
Why do we use `===` (triple equal signs) in conditional statements versus double equal?
In Javascript, triple equal is strict and will do an exact comparison while double equal will try to coerce the variables into the same type and then compare. Example: 1 === '1' will be false while 1 == '1' will be true.
In Node.js, at what level of state is a export of a module stored at?
Global level. A module is a singleton.
In Javascript functions, is an object passed by reference or passed by copy? What does this mean when you modify a value in the object?
Passed by reference. This means that when you modify a value in the object, it will also modify the value in a parent function and all other references to that object.
What are the three control mechanisms of dealing with asynchronous code in Javascript?
Callbacks, Promises and 'async/await'
If they have Express.js experience
Questions about Express.js
What is middleware and what puprpose does it serve?
Middleware is a function that runs before the the main function of an api endpoint is called. It is mainly used to run any shared or common logic that is needed for an entire application before going into the specific endpoint.
What are some common middlewares that most applications need?
Examples are authentication, security, session management, redirecting, parsing data, analytics, logging, error handling
What are pro's and cons of express.js versus other web frameworks such as Django
Express.js is very minimal and allows lots of control and customization of how to build an API. There is also very little convention and you have build the structure for yourself. Djano comes with everything included and has a standard pattern of building. However it can be to rigid and also a bit obfuscated in how it works.
If they have Vue.js experience
Questions about Vue.js
What is two way binding?
Two way binding is when a variable in a component reacts (gets updated or responds) to changes made else where such as a child component.
How does two way binding work (what's the underlying pattern)?
Two way binding works by binding the variable in two ways. The first is by passing the variable as a 'prop' to the child component. The second binding is aa an update to the 'input' event of the child component.
Whats the difference between `props` and `data`?
Props are variabled passed to a component and should not be changed/mutated by the receiving component. Data is the state of a component that can be changed within the component. Changes to either props or data will cause the component to react or update.
Unbundling is the process of redistributing discounts across a bundle. Given the following sales, calculate the new discount amount and the adjustment on the orignal discount per sale.
The way to do unbundling is to get the Total Discount Percent for that Bundle then apply that percentage to each transaction.
ID Bundle FullPrice DiscountedPrice Discount Units
1 A 100 80 20 1
2 A 200 180 20 2
3 A 400 300 100 4
4 B 100 90 20 1
5 B 100 92 20 1
Result
ID Bundle FullPrice NewDiscountedPrice NewDiscount Adjustment
1 A 100 ??? ??? ???
2 A 200 ??? ??? ???
3 A 400 ??? ??? ???
4 B 100 ??? ??? ???
5 B 100 ??? ??? ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment