Skip to content

Commit afe3bde

Browse files
committed
Add expert assessments for C#, Go, and Python
1 parent 02b6174 commit afe3bde

19 files changed

Lines changed: 406 additions & 22 deletions

File tree

LANGUAGE_PARITY_MATRIX.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This matrix tracks module and checkpoint parity across C++, C#, Go, and Python.
44

55
- Canonical order is defined by the C++ track.
6-
- Current priority is to extend checkpoint parity beyond `02-core` now that module parity reaches `04-expert` across all active tracks.
6+
- Module and checkpoint parity now reach `04-expert` across all active tracks.
77
- Status labels:
88
- `Done`: module implemented with example, exercises, and README.
99
- `Planned`: module not implemented yet, already queued in order.
@@ -56,7 +56,7 @@ Current parity progress in non-C++ tracks:
5656
| 4 | inheritance-and-polymorphism | Done | Done | Done | Done |
5757
| 5 | templates-basics | Done | Done | Done | Done |
5858

59-
`04-expert` is now implemented across C#, Go, and Python; the next parity target is projects and assessments beyond `02-core`.
59+
`04-expert` projects and assessments are now implemented across C#, Go, and Python.
6060

6161
### Expert (`04-expert`)
6262

@@ -91,4 +91,4 @@ Status labels:
9191
| 01-foundations | Done | Done | Done | Done |
9292
| 02-core | Done | Done | Done | Done |
9393
| 03-advanced | Done | Done | Done | Done |
94-
| 04-expert | Done | Planned | Planned | Planned |
94+
| 04-expert | Done | Done | Done | Done |

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ This repository teaches programming through small runnable examples and focused
2525
| Language | Current Levels | Coverage | Track Status |
2626
| --- | --- | --- | --- |
2727
| C++ | 00-setup, 01-foundations, 02-core, 03-advanced, 04-expert | Foundations, Core, Advanced, Expert, projects, assessments | Most complete and primary track |
28-
| C# | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 3/4 assessments | Module parity complete through expert, final assessments pending |
29-
| Go | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 3/4 assessments | Module parity complete through expert, final assessments pending |
30-
| Python | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 3/4 assessments | Module parity complete through expert, final assessments pending |
28+
| C# | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
29+
| Go | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
30+
| Python | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
3131

3232
Parity planning reference: [LANGUAGE_PARITY_MATRIX.md](LANGUAGE_PARITY_MATRIX.md)
3333

languages/csharp/CHECKLIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- [ ] Complete `assessments/01-foundations`.
4949
- [ ] Complete `assessments/02-core`.
5050
- [ ] Complete `assessments/03-advanced`.
51+
- [ ] Complete `assessments/04-expert`.
5152

5253
## Parity Goals
5354

languages/csharp/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This track currently covers `01-foundations`, `02-core`, `03-advanced`, and `04-
99
- 5/5 advanced modules implemented (`structs-and-classes`, `constructors-and-invariants`, `copy-and-move-semantics`, `inheritance-and-polymorphism`, `templates-basics`).
1010
- 5/5 expert modules implemented (`memory-management-and-raii`, `smart-pointers-in-depth`, `concurrency-basics`, `performance-and-profiling-basics`, `modularization-and-build-structure`).
1111
- 4/4 projects implemented (`01-foundations`, `02-core`, `03-advanced`, `04-expert`).
12-
- 3/4 assessments implemented (`01-foundations`, `02-core`, `03-advanced`).
12+
- 4/4 assessments implemented (`01-foundations`, `02-core`, `03-advanced`, `04-expert`).
1313
- Same module naming as C++, Python, and Go for parity.
1414

1515
## Prerequisites
@@ -69,6 +69,7 @@ dotnet run --project 01-foundations/types-and-io/example/types-and-io-example.cs
6969
- [01-foundations](./assessments/01-foundations/README.md)
7070
- [02-core](./assessments/02-core/README.md)
7171
- [03-advanced](./assessments/03-advanced/README.md)
72+
- [04-expert](./assessments/04-expert/README.md)
7273

7374
## Progress Tracking
7475

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Assessment 04: Expert
2+
3+
## Goal
4+
5+
Practice shared-data coordination, concurrent work distribution, and thread-safe aggregation.
6+
7+
## Task
8+
9+
Write a program that:
10+
11+
1. Keeps the assessment data in one owned container.
12+
2. Splits work across multiple tasks.
13+
3. Uses `lock` to protect shared aggregation state.
14+
4. Computes:
15+
- total sum
16+
- minimum value
17+
- maximum value
18+
5. Prints per-worker partial sums and final summary.
19+
20+
## Quick Run
21+
22+
```bash
23+
dotnet run --project assessment-04-expert.csproj
24+
```
25+
26+
## Expected Output (shape)
27+
28+
```text
29+
Worker 0 partial sum: ...
30+
Worker 1 partial sum: ...
31+
...
32+
Final summary:
33+
Total: ...
34+
Minimum: ...
35+
Maximum: ...
36+
```
37+
38+
## What To Check
39+
40+
- Shared updates happen only inside the `lock`.
41+
- Each worker computes its own partial result before merging it.
42+
- All tasks finish before the final summary is printed.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>disable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
</Project>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
5+
sealed class DataSet
6+
{
7+
public DataSet(List<int> values)
8+
{
9+
Values = values;
10+
}
11+
12+
public List<int> Values { get; }
13+
}
14+
15+
sealed class Summary
16+
{
17+
public long Total { get; set; }
18+
public int Minimum { get; set; } = int.MaxValue;
19+
public int Maximum { get; set; } = int.MinValue;
20+
}
21+
22+
class Program
23+
{
24+
static void Main()
25+
{
26+
DataSet data = new DataSet(new List<int> { 12, 7, 25, 4, 31, 19, 2, 45, 18, 9, 27, 6 });
27+
28+
int workerCount = 3;
29+
int chunkSize = (data.Values.Count + workerCount - 1) / workerCount;
30+
Summary globalSummary = new Summary();
31+
object gate = new object();
32+
33+
Task[] tasks = new Task[workerCount];
34+
35+
for (int workerId = 0; workerId < workerCount; workerId++)
36+
{
37+
int capturedWorkerId = workerId;
38+
int begin = capturedWorkerId * chunkSize;
39+
int end = Math.Min(begin + chunkSize, data.Values.Count);
40+
41+
tasks[capturedWorkerId] = Task.Run(() =>
42+
{
43+
if (begin >= end)
44+
{
45+
return;
46+
}
47+
48+
long localTotal = 0;
49+
int localMin = data.Values[begin];
50+
int localMax = data.Values[begin];
51+
52+
for (int index = begin; index < end; index++)
53+
{
54+
int value = data.Values[index];
55+
localTotal += value;
56+
57+
if (value < localMin)
58+
{
59+
localMin = value;
60+
}
61+
62+
if (value > localMax)
63+
{
64+
localMax = value;
65+
}
66+
}
67+
68+
lock (gate)
69+
{
70+
Console.WriteLine($"Worker {capturedWorkerId} partial sum: {localTotal}");
71+
globalSummary.Total += localTotal;
72+
if (localMin < globalSummary.Minimum)
73+
{
74+
globalSummary.Minimum = localMin;
75+
}
76+
77+
if (localMax > globalSummary.Maximum)
78+
{
79+
globalSummary.Maximum = localMax;
80+
}
81+
}
82+
});
83+
}
84+
85+
Task.WaitAll(tasks);
86+
87+
Console.WriteLine();
88+
Console.WriteLine("Final summary:");
89+
Console.WriteLine($"Total: {globalSummary.Total}");
90+
Console.WriteLine($"Minimum: {globalSummary.Minimum}");
91+
Console.WriteLine($"Maximum: {globalSummary.Maximum}");
92+
}
93+
}

languages/csharp/assessments/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ This directory contains level-end tasks that check understanding without step-by
77
1. [01-foundations](./01-foundations/README.md)
88
2. [02-core](./02-core/README.md)
99
3. [03-advanced](./03-advanced/README.md)
10+
4. [04-expert](./04-expert/README.md)
1011

1112
## Next Gap
1213

13-
`04-expert` assessment does not exist yet in this track.
14+
All assessment checkpoints through `04-expert` are available in this track.

languages/go/CHECKLIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- [ ] Complete `assessments/01-foundations`.
4949
- [ ] Complete `assessments/02-core`.
5050
- [ ] Complete `assessments/03-advanced`.
51+
- [ ] Complete `assessments/04-expert`.
5152

5253
## Parity Goals
5354

languages/go/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This track currently covers `01-foundations`, `02-core`, `03-advanced`, and `04-
99
- 5/5 advanced modules implemented (`structs-and-classes`, `constructors-and-invariants`, `copy-and-move-semantics`, `inheritance-and-polymorphism`, `templates-basics`).
1010
- 5/5 expert modules implemented (`memory-management-and-raii`, `smart-pointers-in-depth`, `concurrency-basics`, `performance-and-profiling-basics`, `modularization-and-build-structure`).
1111
- 4/4 projects implemented (`01-foundations`, `02-core`, `03-advanced`, `04-expert`).
12-
- 3/4 assessments implemented (`01-foundations`, `02-core`, `03-advanced`).
12+
- 4/4 assessments implemented (`01-foundations`, `02-core`, `03-advanced`, `04-expert`).
1313
- Same module naming as C++, Python, and C# for parity.
1414

1515
## Prerequisites
@@ -69,6 +69,7 @@ go run 01-foundations/types-and-io/example/main.go
6969
- [01-foundations](./assessments/01-foundations/README.md)
7070
- [02-core](./assessments/02-core/README.md)
7171
- [03-advanced](./assessments/03-advanced/README.md)
72+
- [04-expert](./assessments/04-expert/README.md)
7273

7374
## Progress Tracking
7475

0 commit comments

Comments
 (0)