Spring Boot (Coding) Assessment Test

Spring Boot (Coding)

 60 Minutes
 3 Questions


This coding test is designed to assess your knowledge of coding with Spring Boot. You will be asked to complete a series of coding challenges that evaluate your ability to write and implement code using the Spring Boot framework. The challenges will cover various topics, including:
- Spring Boot REST APIs - Building RESTful web services using Spring Web, handling request mappings, and returning JSON responses.
- Dependency Injection & Spring Beans - Understanding how to define and manage beans, use @Autowired, and work with Spring's dependency injection mechanism.
- Spring Boot Security - Configuring authentication and authorization using Spring Security, implementing JWT-based authentication, and securing endpoints.
- Exception Handling - Using @ControllerAdvice and @ExceptionHandler for global and specific exception handling in a Spring Boot application.
- Spring Boot Configuration & Properties - Managing application properties using application.properties or application.yml, and working with @Value and @ConfigurationProperties.
-Spring Boot and Cloud Deployment - Deploying Spring Boot applications to cloud platforms such as AWS, Azure, or Google Cloud.


Example Question:

Coding
You are requested to create a service for the bank in this question.
Given the customer's name and amount of money to deposit or withdraw (by the number sign +/-), you should indicate the success or failure by the following:

If the customer balance doesn't have enough money for the withdrawal, you should return -1 to signal error, otherwise 0.

The current balances are as follows:
  1. BruceWayne -
  2. The current balance is 58$.
  3. ClarkKent -
  4. The current balance is 21$.
  5. DianaPrince -
  6. The current balance is 112$.


Your API should support the following:

Url: UpdateBalance
Method: POST
Request Body (as JSON) :
{
"customerName": ....,
"amount" : ....
}

The amount can be positive for a deposit or negative for a withdrawal.
Response: 0 for success, -1 for error.

Url: GetBalance
Method: GET
Parameters: customerName
Response: the customer balance.

*All responses must be strings (not numbers or objects)

For example:
/GetBalance?customerName=BruceWayne
Response: 58
--------
Post to /UpdateBalance:
{
"customerName": "BruceWayne",
"amount" : 5
}
Response: 0
--------
/GetBalance?customerName=BruceWayne
Response: 63
Because the balance was updated in the example above
--------
Post to /UpdateBalance:
{
"customerName": "BruceWayne",
"amount" : -500
}

Response: -1
Because the balance doesn't have enough money to withdraw 500$.