This assessment evaluates your understanding of:
- Data Structures (Lists, Maps)
- Data Manipulation
- String Formatting
- Loops
- CLI Commands (Conceptual)
- APIs (Conceptual)
This assessment contains two sections:
You must implement the required methods inside:
Summative.java
Your code must:
- Compile successfully
- Follow the provided method signatures
- Pass all JUnit tests
You must answer conceptual questions inside:
answers.txt
- Do NOT remove the comments
- Write your answers below each question
- Use clear explanations and examples
Implement all methods in:
Summative.java
Ensure:
- Code compiles
- Logic works correctly
- All 191 tests pass
Complete all questions in:
answers.txt
Provide clear and structured explanations.
summative-maven/
├── pom.xml
├── src/
│ ├── main/
│ │ └── java/
│ │ └── com/
│ │ └── assessment/
│ │ └── Summative.java
│ └── test/
│ └── java/
│ └── com/
│ └── assessment/
│ └── SummativeTest.java
├── answers.txt
├── loadshedding.json
└── README.md
You must have the following installed:
- ☕ Java 17
- 📦 Maven
- 🌐 Internet connection (to download dependencies)
mvn testmvn -Dtest=SummativeTest testmvn -Dtest=SummativeTest#testBatchApiDispatcherLogic testThis project uses:
- JUnit 5
- Maven Surefire Plugin
All tests are located in:
src/test/java/com/assessment/
Your goal is to make all tests pass successfully.
The South African Social Security Agency (SASSA) needs to send SMS notifications to citizens.
However, the SMS gateway has a strict rule:
Your job is to split a list of user IDs into batches of 5.
["ID1","ID2","ID3","ID4","ID5","ID6","ID7"]
[
["ID1","ID2","ID3","ID4","ID5"],
["ID6","ID7"]
]
- Maximum 5 IDs per batch
- Maintain original order
- Do not lose data
- Do not modify the original list
The Springboks rugby team is on tour.
Match results are recorded as:
"W" → Win
"L" → Loss
Your task is to determine the longest consecutive sequence of wins.
["W","L","W","W","L","W","W","W"]
3
Because the longest streak of "W" is 3 in a row.
The South African Weather Service (SAWS) is monitoring temperature spikes.
A local peak occurs when a temperature is:
- greater than the value before it
- greater than the value after it
[30,32,31,35,33,36,34]
[32,35,36]
- Ignore first and last elements
- A peak must be strictly greater than neighbours
- Return peaks in the same order
Eskom recorded loadshedding incidents across South Africa.
Each record contains information like:
- stage
- duration_hours
- area
- municipality
- province
Your function only needs:
stage
duration_hours
You must calculate total hours per stage.
[
{stage:2, duration_hours:2.5},
{stage:4, duration_hours:4.0}
]
{
"Stage 2": 2.5,
"Stage 4": 4.0
}
- Sum
duration_hoursper stage - Format keys like:
"Stage 2"
- Round totals to 2 decimal places
- Return empty Map if no records
The Drakensberg Hiking Club needs a terminal badge generator.
The badge is a hollow triangle made from * characters.
- Triangle must be centered
- First row → 1 star
- Middle rows → 2 stars
- Last row → solid stars
- Width =
2 * height - 1
Height:
5
Triangle:
*
* *
* *
* *
*********
Return:
[
" *",
" * *",
" * *",
" * *",
"*********"
]
Trailing spaces are not required.
Answer these questions inside:
answers.txt
You are working on a Linux server in Sandton.
Complete the following tasks:
- List files and folders
- Move into folder
config - Read contents of
settings.conf - Create folder
backup - Copy
settings.confintobackup - Delete
server.log
Explain:
- The commands used
- What each command does
- Any potential risks
Explain loops to a junior developer.
Your answer should include:
- What loops are
- Types of loops
- When to use each
- Real programming examples
Explain immutable data types in Python.
Include:
- What immutable means
- Examples of immutable types
- Difference between mutable and immutable
- What happens when modification is attempted
Explain APIs to a non-technical product manager.
Include:
- What an API is
- How HTTP works
- Types of HTTP requests
- What endpoints are
- How mobile apps communicate with servers
❌ Do NOT modify test files
SummativeTest.java
Only modify:
Summative.java
answers.txt
- Use ArrayList for lists
- Use HashMap for key-value storage
- Use StringBuilder for building strings
- Use loops carefully
Before submitting:
✅ All tests pass (mvn test)
✅ Code compiles
✅ answers.txt completed
✅ No test files modified
This assessment tests your ability to:
- Think logically
- Work with data structures
- Write clean Java code
- Solve real-world problems
Stay calm, test often, and debug step-by-step 🚀