test grade
test_gradeCalculates a test or exam grade from the number of correct answers and total questions. Returns the percentage score, letter grade, points missed, and GPA points. Supports US grading (A/B/C/D/F with 4.0 GPA scale), UK grading (First/2:1/2:2/Third/Fail), and percentage-only mode. US thresholds: A>=90, B>=80, C>=70, D>=60, F<60. UK thresholds: First>=70, 2:1>=60, 2:2>=50, Third>=40, Fail<40. Useful for students checking scores and teachers computing class statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| total | Yes | Total number of questions on the test. Must be a positive integer. | |
| correct | Yes | Number of questions answered correctly. Must be a non-negative integer. | |
| grading_scale | No | Grading scale to use. 'us' for A-F letter grades, 'uk' for First/2:1/2:2/Third/Fail, 'percentage_only' for just the percentage. | us |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gpa_points | Yes | GPA points on a 4.0 scale (US only). A=4.0, B=3.0, C=2.0, D=1.0, F=0. Null for UK and percentage_only. | |
| percentage | Yes | Score as a percentage (0-100). | |
| letter_grade | Yes | Letter grade based on the selected grading scale. Null if percentage_only. | |
| points_missed | Yes | Number of questions answered incorrectly (total - correct). |