0% found this document useful (0 votes)
82 views

Node Js Assessment Question set

The document outlines a set of Node.js assessment questions that require writing JavaScript programs for various tasks, including file creation, REST GET requests, mathematical operations, password validation, and JSON cleaning. Each task specifies input and expected output formats, along with example scenarios. Additionally, it includes open-ended questions regarding Git and SQL commands.

Uploaded by

Pranali Gawale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Node Js Assessment Question set

The document outlines a set of Node.js assessment questions that require writing JavaScript programs for various tasks, including file creation, REST GET requests, mathematical operations, password validation, and JSON cleaning. Each task specifies input and expected output formats, along with example scenarios. Additionally, it includes open-ended questions regarding Git and SQL commands.

Uploaded by

Pranali Gawale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Node Js Assessment Question set

Node.js Print Files


In the JavaScript file, write a program to first create a file in the current directory with the name
newfile.txt 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

file.js, helloworld.txt, abc.txt

Node.js REST GET Simple

In the JavaScript file, write a program to perform a GET request on the route
https://coderbyte.com/api/challenges/json/rest-get-simple and then print to the

console the hobbies property in the following format: ITEM1, ITEM2, ...

Example Output

running, painting
Node.js 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".

Node.js JSON Cleaning

In the JavaScript file, write a program to perform a GET request on the route
https://coderbyte.com/api/challenges/json/json-cleaning 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?

You might also like