0% found this document useful (0 votes)
287 views8 pages

Bluestock FinTech Assessment Overview

The document describes a 60 minute assessment test for a FinTech developer position. The test has 4 sections covering T-SQL, C#, JavaScript, and a bonus T-SQL question. It provides instructions on how to structure responses, allows for open book, and provides links to code testing platforms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
287 views8 pages

Bluestock FinTech Assessment Overview

The document describes a 60 minute assessment test for a FinTech developer position. The test has 4 sections covering T-SQL, C#, JavaScript, and a bonus T-SQL question. It provides instructions on how to structure responses, allows for open book, and provides links to code testing platforms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

FinTech Dev - Assessment Test

Version 2.1

Duration: 60 minutes
Instructions:
i) This is open book test.

ii) There are three mandatory sections in the test:


Section 1: T-SQL
Section 2: C#/.NET/Algorithm
Section 3: JavaScript

Each section has one question.

iii) There is a bonus Section 4 with a supplementary T-SQL question.


Please attempt the bonus question only if you are done with the mandatory sec

iv) You may want to take help of fiddles to test run your code.
Fiddles for C#, JavaScript and T-SQL can be found at link1, link2 and link3 respectively.
[To be able to see output from [Link]() in JSFiddle, you may consider using the solution mentioned here]

Section 1: T-SQL
Consider a database that contains following tables.

Write a T-SQL query for a report. The query must meet the following requirements:

 Use the first initial of the table as an alias.


 Return the most recent order date for each customer.
 Retrieve FirstName of the person (who placed the order) as CustomerName.
 Return the Order date in a column named MostRecentOrderDate that appears as the last
column in the report.
 Return the most recent orders first.

Your answer here:

Select [Link] as CustomerName, [Link],[Link] ,[Link] as MostRecentOrderDate


from [Link] as O INNER JOIN [Link] as C on ([Link]=[Link])

Where [Link] = Max([Link])

GroupBy [Link], [Link], [Link],[Link]

Order by [Link] ASC


Section 2: C#/.NET/Algorithm
Write a function that, when passed a list and a target sum, prints combinations of all numbers, whose
sum is equal to the target sum. If there are no two numbers, the function should print “no pair found”.

For example,

FindTwoSum(new List<int>() { 3, 1, 5, 7, 5, 9 }, 10)

Should print in the console

{3, 7}

{1, 9}

{5, 5}

Your answer here:


using System;
using [Link];

Class Mine

Static bool FindTwoSum(List<Int> numbers, int Sum)

Int size = [Link];


sort(numbers, 0, size - 1);

Int l,r
while (l < r) {
            if (numbers[l] + numbers[r] == sum)
[Link](numbers[l], numbers[r]);
                return true;
            else if (numbers [l] + numbers[r] < sum)
                l++;
            else // numbers[i] + numbers[j] > sum
                r--;
        }
        return false;
[Link](“no pair fpund”)
 static int partition(List<Int> numbers, int low, int high)
    {
        int pivot = numbers[high];
 
        // index of smaller element
        int i = (low - 1);
        for (int j = low; j <= high - 1; j++) {
            // If current element is smaller
            // than or equal to pivot
            if (numbers[j] <= pivot) {
                i++;
 
                int temp = numbers [i];
                numbers [i] = numbers [j];
                numbers [j] = temp;
            }
        }
 
        
        int temp1 = numbers [i + 1];
        numbers [i + 1] = numbers [high];
        numbers [high] = temp1;
 
        return i + 1;
    }
static void sort(List<Int> numbers, int low, int high)
    {
        if (low < high) {
            int pi = partition(numbers, low, high);
            sort(numbers, low, pi - 1);
            sort(numbers, pi + 1, high);
        }
    }
 

public static void Main ()


    {
         List<int> numbers = new List<int>() {3,1,5,7,5,9};   
      int Sum = 10;
          FindTwoSum (numbers, sum)
     
       
    }

}
Section 3: JavaScript

Write a function called getClone that takes an object and creates an object copy of it but does not copy
deep property of the input object.

Example:

var obj = {foo : 'Bar'};

var cloneObj = getClone(obj); // getClone is the function which you have to write

[Link](cloneObj === getClone(obj)); // this should return false

[Link](cloneObj == getClone(obj)); // this should return true

Your answer here:

Var obj = {foo : ‘Bar’};

Var CloneObj = getClone(obj);


[Link](CloneObj === GetClone(obj))

[Link](CloneObj == GetClone(obj))

GetClone(Obj)

Let copy = obj;

[Link]=’Bar’;

Section 4: Bonus T-SQL


Consider the same two tables from previous T-SQL question.

Write a T-SQL query for a report. The query must meet the following requirements:

 Use the first initial of the table as an alias.


 Return year and month wise total sales count.
 First column should be years in ascending order. The remaining columns should be twelve
months.

An example query output:

Your answer here:

Select Year([Link]) as SalesYear,

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 1) as ‘Jan’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 2) as ‘Feb’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 3) as ‘Mar’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 4) as ‘Apr’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 5) as ‘May’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 6) as ‘Jun’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 7) as ‘Jul’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 8) as ‘Aug’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 9) as ‘Sep’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 10) as ‘Oct’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 11) as ‘Nov’

Count(DatePart(month, [Link]) from o where DatePart(month, [Link]) = 12) as ‘Dec’

From [Link] as o

Order by Year([Link]), month([Link])


Group by Year([Link]), month([Link])

Common questions

Powered by AI

The errors in the SQL query syntax stem from the misuse of aggregation functions and aliases without sufficient grouping logic. Multiple COUNT(DatePart(month, O.orderdate)) expressions lack commas and fail to use CASE statements for conditional counting, leading to aggregation logic errors. To rectify, the query should incorporate CASE within COUNT to count records conditionally per month, ensuring it uses commas correctly between monthly and yearly aggregates, e.g., COUNT(CASE WHEN DatePart(month, O.orderdate) = 1 THEN 1 END) as 'Jan', and so forth, to correctly execute for monthly aggregation .

Challenges from implementing shallow cloning without deep copying in web applications include unexpected mutations to the cloned object affecting the original object if both point to a reference (e.g., nested objects). This could lead to bugs where modifying one affects the other unintentionally, especially when properties are objects themselves, leading to unintended side-effects. In collaborative environments or complex state management scenarios, relaxed cloning may introduce consistency issues and overwrites unless proper guards or copying techniques (e.g., deep cloning methods) are utilized .

The JavaScript function aimed at cloning an object achieves this by referencing the input object directly into a new variable instead of creating a deep copy. This is indicated in the example where var cloneObj = getClone(obj) and the function simply reassigns 'let copy = obj'. When the cloned object is compared using the triple equals (===) operator, it returns false, while the double equals (==) returns true, reflecting that it is a shallow clone without deep property copy .

The bonus T-SQL query structures yearly and monthly sales data using a query that groups orders by year using the Year() function and then collectively counts order occurrences per month using the DatePart(month, O.orderdate) function. This is achieved by organizing the SELECT statement to include columns for each month aliasing them as 'Jan', 'Feb', etc., and by using COUNT() on conditions checking for each month. The GROUP BY clause ensures that counts are organized against the 'Year' and 'Month', while the ORDER BY clause arranges them in ascending order .

The primary flaw in the C# code is the logical error in the conditional loop where the function returns 'true' immediately after finding the first pair, using 'return true;' within the loop. This prematurely exits the function, preventing further valid pairs from being printed, thus failing to find all solutions. To resolve this, the 'return true;' should be replaced with a mechanism to collect all valid pairs (e.g., using a list of tuples) and then after the loop completes, returns a single boolean indicating if any pairs were found .

The T-SQL query selects the most recent order dates by joining the 'orders' and 'customers' tables using the INNER JOIN clause on CustomerID fields. It retrieves the FirstName as CustomerName and OrderDate as MostRecentOrderDate. The query ensures ordering by using the ORDER BY clause with O.OrderDate ASC (though it should logically use DESC for most recent first) and addresses alias usage by using initials 'O' for orders and 'C' for customers in the SELECT statement. The GROUP BY clause is used to organize data by CustomerName, OrderId, CustomerID, and OrderDate .

The significance of using '===' versus '==' lies in the type and value comparison nuances in JavaScript. The '===' operator checks for both type and value equality, asserting if two objects are strictly the same reference, which in the case of 'getClone' would return 'false' as it creates a new reference. Meanwhile, '==' checks for values only, implying that if the structure and values are equal, it returns 'true'. Thus, '===' identifies new object instances, while '==' is good for comparing content equality when types may align without reference equivalence .

The 'FindTwoSum' function employs a two-pointer strategy, which involves sorting the input list first. After sorting, it uses two indices 'l' and 'r' to scan the list from both ends. Adjustments with l++ and r-- are made based on comparisons to the target sum. The algorithmic complexity for this approach is O(n log n) due to the sorting process, followed by an O(n) complexity for the two-pointer search, making the overall complexity O(n log n).

The primary purpose of the C# function 'FindTwoSum' is to identify and print all combinations of numbers from a list that sum to a specified target. The function handles unique conditions by first sorting the list and using a two-pointer approach (using indices 'l' and 'r') to iterate through the list to find pairs that add up to the target sum. If a sum is less than the target, the 'l' pointer is incremented; if greater, the 'r' pointer is decremented. This efficiently reduces the number of pairs evaluated .

The 'partition' function in C# implements a core component of the quicksort algorithm. It selects a pivot element and rearranges elements around it so elements less than the pivot come before, while greater elements follow, effectively splitting the list into two parts. The 'sort' function recursively applies this partitioning to subarrays defined by the indices 'low' and 'high'. This recursive splitting is the hallmark of quicksort, where the partition function dictates the division of the list, thus facilitating efficient in-place sorting .

You might also like