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

React js Assessment test

The document outlines several programming challenges including calculating a moving median from an array, converting a string to camel case, executing a SQL query to sort ages, and modifying a React component for button toggling. Each challenge specifies the input format and expected output. Additionally, there is a question about RESTful APIs and their advantages.

Uploaded by

Pranali Gawale
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

React js Assessment test

The document outlines several programming challenges including calculating a moving median from an array, converting a string to camel case, executing a SQL query to sort ages, and modifying a React component for button toggling. Each challenge specifies the input format and expected output. Additionally, there is a question about RESTful APIs and their advantages.

Uploaded by

Pranali Gawale
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Moving Median

Have the function MovingMedian(arr) read the array of numbers stored in arr which will contain

a sliding window size, N, as the first element in the array and the rest will be a list of numbers. Your
program should return the Moving Median for each element based on the element and its N-1
predecessors, where N is the sliding window size. The final output should be a string with the
moving median corresponding to each entry in the original array separated by commas.

Note that for the first few elements (until the window size is reached), the median is computed on a
smaller number of entries. For example: if arr is [3, 1, 3, 5, 10, 6, 4, 3, 1] then your program should

output "1,2,3,5,6,6,4,3"

Camel Case

Have the function CamelCase(str) take the str parameter being passed and return it in proper

camel case format where the first letter of each word is capitalized (excluding the first letter). The
string will only contain letters and some combination of delimiter punctuation characters separating
each word.

For example: if str is "BOB loves-coding" then your program should return the string

bobLovesCoding.

SQL Sort Ages


Hide Question
In this MySQL challenge, your query should return the rows from your table where LastName =

Smith or FirstName = Robert and the rows should be sorted by Age in ascending order. Your

output should look like the following table.

React Button Toggle

We provided some simple React template code. Your goal is to modify the component so that you
can properly toggle the button to switch between an ON state and an OFF state. When the button is
on and it is clicked, it turns off and the text within it changes from ON to OFF and vice versa. Make

use of the component state for this challenge.

You are free to add classes and styles, but make sure you leave the component ID's and classes
provided as they are. Submit your code once it is complete and our system will validate your output.
​ What is a RESTful API and what are its advantages?N/A

You might also like