Node Js Assessment Question set
[Link] Print Files
In the JavaScript file, write a program to first create a file in the current directory with the name
[Link] filled with any content. Then, using exec, print to the console all the files in the
current directory so that they are in the following format: FILENAME, FILENAME, ...
Example Output
[Link], [Link], [Link]
[Link] REST GET Simple
In the JavaScript file, write a program to perform a GET request on the route
[Link] and then print to the
console the hobbies property in the following format: ITEM1, ITEM2, ...
Example Output
running, painting
[Link] Math Parse
In the JavaScript file, write a function to parse a string that contains a route name called math, and 2
query parameters which will be numbers. Your function should output a JSON stringified array that
contains the following items in this exact order: the difference, product, quotient, and sum of the
query parameters all rounded to the nearest integer.
For example, if the input is /math?a=10&b=5, then the output should be [5,50,2,15]
Simple Password
Have the function SimplePassword(str) take the str parameter being passed and determine if
it passes as a valid password that follows the list of constraints:
1. It must have a capital letter.
2. It must contain at least one number.
3. It must contain a punctuation mark or mathematical symbol.
4. It cannot have the word "password" in the string.
5. It must be longer than 7 characters and shorter than 31 characters.
If all the above constraints are met within the string, the your program should return the string true,
otherwise your program should return the string false. For example: if str is "apple!M7" then your
program should return "true".
[Link] JSON Cleaning
In the JavaScript file, write a program to perform a GET request on the route
[Link] and then clean the object
according to the following rules: Remove all keys that have values of N/A, -, or empty strings. If one
of these values appears in an array, remove that single item from the array. For all keys removed,
create a key/value pair at the end of the output object with the key items_removed and the value is
the count. The console log the modified object as a string.
Example Input
{"name":{"first":"Daniel","middle":"N/A","last":"Smith"},"age":45}
Example Output
{"name":{"first":"Daniel","last":"Smith"},"age":45, "items_removed": 1}
Open-ended questions ?
1. What is the difference between git merge and git rebase?
2. What is the difference between the DELETE and TRUNCATE commands in SQL?