Software Engineer Practical Test
1. In a user database table, we store User_ID, User_Name, User_Email. Due to an
application bug, the application does not convert email addresses to lowercase when
stored into the user table. Write a query to retrieve the User_ID of the user whose email
address contains some upper case characters (E.g. Username@[Link],
my_Username@[Link] ).
2. In the G2G marketplace, sellers can create multiple offer listings under the same
category. For example, on this category listing page: Coc1 Account for Sale, you might
notice that the first few pages are dominated by offers from the same seller.
To ensure fair visibility for all sellers, G2G wants to implement a round-robin sequence
for displaying offer listings. This means each seller’s offers should be evenly distributed
throughout the listing pages, rather than being grouped together.
Requirements:
1. The listing page allows buyers to filter and sort the results.
2. The number of offer listings can range from 10k to 100k.
3. The system must support efficient retrieval and display of listings in a round-robin
manner.
Task:
1. Explain how you would design and implement this system to support the
round-robin display of offers.
2. Provide a high-level architecture of your solution.
3. Include a sample database schema.
4. Provide sample queries and code snippets that demonstrate how to achieve the
round-robin display.
Note: Ensure your solution considers performance and scalability, especially given the
potential volume of listings.
3. Given a list of strings, write a function to determine the minimum number of deletions
required for each string so that no two adjacent characters are the same.
Example:
Input: ["AAAA", "BBBBB", "ABABABAB", "AAABBB"]
Output: [3, 4, 0, 4]
4. Your company is developing a reward system with the following requirements:
● Customers will be rewarded with reward points when a sales order is in
Delivered status.
● For every USD 1 of sales amount, customers will receive 1 point. If the sales
amount is not in USD, it should be converted to its equivalent amount in USD for
the reward calculation.
● Reward points will be credited to the customer's account with an expiry date,
which is 1 year from the date of credit.
● Points can be used for new order payments, where every 1 point is equivalent to
USD 0.01.
Please provide:
A. Flowchart or Sequence UML Diagram:
- Create a flowchart or sequence UML diagram illustrating the reward system
process from order completion to points redemption.
B. Database Schema Design:
- Design a MySQL database schema to support the reward system. Include
tables for customers, orders, and reward points.
C. Function Implementations:
- Write functions to:
○ Calculate and credit reward points to a user’s account after order
completion.
○ Calculate and deduct reward points for new order payments.