Area 01 · Data manipulation
Class grade sheet
A teacher needs a ranked grade sheet from three quiz scores per student, and a quick way to look up one student's rank.
- Spec no.
- HO-02
- Level
- Exam-level
- Time box
- 1 h 30 min
- Reference
- Java · C#
- Grading
- Self-assessed · rubric is ours, not DICT's
01 Coverage
| Area | Sub-skills practised | Role |
|---|---|---|
| 01 Data manipulation | Array handling, ArrayList handling, Searching, Validation, String | Primary |
| 05 Data structures and algorithms | Sorting, Searching | Also |
| 06 Control structures | Conditional, Iteration | Also |
Sign up to start coding practice
Read the task freely. An account is required before editing and running a solution. Code runs also need an internet connection.
Sign up or sign in02 Requirements
- Read the number of students (1 to 50). While it is out of range or not a number, print Enter a number from 1 to 50: and read again.
- Read one line per student: a one-word name and three integer scores from 0 to 100, stored in a fixed-size array per student. On a bad line print Invalid line, re-enter: and read again.
- Average = sum / 3, printed to two decimals. Remark is Passed if the average is at least 75, otherwise Failed. Keep 75 and 100 as named constants.
- Sort by average from highest to lowest. Break ties alphabetically by name.
- Print the table with a NAME / AVERAGE / REMARK header, then Class average: x.xx and Passed: p of n.
- Then accept find <name> commands until input ends. Print Found: name avg rank r (rank counts from 1) or Not found: name. Matching ignores case.
03 Input and output
- Line 1: student count
- n lines: name s1 s2 s3
- Optional: find <name> lines
- Header, then name left-aligned in 10 columns, average right-aligned in 7, then the remark
- Class average and pass count
- One line per find command
3
Reyes 80 90 85
Cruz 70 72 75
Abad 85 90 80
find CruzNAME AVERAGE REMARK
Abad 85.00 Passed
Reyes 85.00 Passed
Cruz 72.33 Failed
Class average: 80.78
Passed: 2 of 3
Found: Cruz 72.33 rank 3Match the sample exactly first, then write at least two test inputs of your own.
04 Edge cases to test
- Two students with the same average (the sample has one)
- A score of 101 or abc
- A line with only two scores
- find for a name that is not on the sheet
05 Starter outline and hints
class Student { name; int[3] scores; average(); remark() }loop until 1 ≤ n ≤ 50loop until list.size == n: parse line → Student or re-promptsort by average desc, then name ascprint table, class average, pass countwhile more lines: if find <name> → linear search for rank
Hint 1
Compare averages with a comparator, then chain a name comparison for ties.
Hint 2
The list is sorted by average, so searching by name has to be linear.
06 Practice rubric
| Criterion | Sub-skills | Look for | Pts |
|---|---|---|---|
| Correct results | Array handlingSorting | Averages, remarks, order and tie-break match the sample and your own tests. | 35 |
| Validation | ValidationIteration | Re-prompts on bad counts and bad lines without crashing. | 20 |
| Collections | ArrayList handlingArray handling | A fixed array for the three scores and a growable list of students. | 15 |
| Search | Searching | find returns the right rank and handles not-found. | 15 |
| Output and constants | String | Aligned columns, two decimals, no magic numbers. | 15 |
| Total | 100 | ||
Our own weighting for practice. It is not the DICT scoring scheme.
07 Self-check
Tick only what you have verified by running your own program.
Loading saved checks…
08 Reference solution
Both versions compiled and reproduced the sample output on Java 21 and .NET 8 when this site was built. Reference solutions are in Java and C#. The 2023 FAQ copy also lists C, C++ and Visual Basic 6.0 / .NET; the same structure carries over, but you will need your language's own file and database APIs.
Try the whole brief first. The reference is one correct approach, not the only one, and reading it early removes most of the practice value.
09 Exam-day habits
- Work without internet search to simulate exam conditions.
- Type the sample input yourself and compare your output line by line before you look at the reference.