From Latin 'examinare' (to weigh on a balance) — every exam is etymologically a weighing of what you know.
A formal test of knowledge or ability in a particular subject.
From Latin exāmen (examination, testing, the tongue or pointer of a balance-scale), from exigere (to drive out, to weigh, to measure, to demand), from ex- (out, thoroughly) + agere (to drive, to act, to do). Latin agere traces to PIE *h2eg- (to drive, to lead animals). The original exāmen referred to the pointer of a weighing scale — the instrument that determined truth
An 'exam' is etymologically a weighing on a balance scale — Latin 'exāmen' meant the needle of a scale before it meant a test. And the same Latin root 'agere' (to drive) that gave us 'exam' also produced 'agent' (one who acts), 'agile' (able to move), 'essay' (an attempt), and 'exact' (driven to precision).