Validation, verification and trace tables
Diperkenalkan
9:16
Siklus Hidup Pengembangan Program
Setiap aplikasi di telepon Anda ditulis oleh seseorang seperti ini. Namun mereka tidak mulai dengan mengetik kode. Sebelum baris pertama, masalah dipelajari, solusinya dirumuskan…
Narasi bahasa Inggris · takarir bahasa Inggris dan 中文 yang dapat dipilih
In this lesson
| English | Makna |
|---|---|
| validation/ˌvælɪˈdeɪʃn/ | validasi |
| verification/ˌverɪfɪˈkeɪʃn/ | verifikasi |
| trace table/treɪs ˈteɪbl/ | tabel pelacakan |
| range check/reɪndʒ tʃek/ | pemeriksaan rentang |
| length check/leŋθ tʃek/ | pemeriksaan panjang |
| presence check/ˈprezəns tʃek/ | pemeriksaan keberadaan |
| test data/test ˈdeɪtə/ | data uji |
Checking and tracing
- When data is entered, we check it to reduce mistakes.
- Validation 验证 checks it is sensible; verification 核实 checks it was copied correctly.
- A trace table 追踪表 follows an algorithm step by step.
Validation
- Validation checks data is sensible and follows the rules (it can't check the data is true).
- Range check 范围检查 (between limits), length check 长度检查 (right number of characters), type check (right kind of data), presence check 存在性检查 (not blank), format check (right pattern, e.g. dd/mm/yyyy), and a check digit (an extra digit confirming a number).

Checking that an age is between 0 and 120 is a:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
A range check confirms a value lies within allowed limits.
Match each validation check to its purpose.
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
Presence = not blank; type = right kind of data; format = right pattern.
Verification
- Verification checks data was copied or entered correctly (no typing mistakes).
- Visual check — a person compares the typed data with the original.
- Double entry — the data is entered twice and the two copies are compared.
Double entry of data is a validation check.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
False. Double entry is a verification check: it confirms data was entered correctly. Validation checks that data is sensible, such as a range or type check.
Entering data twice and comparing the two copies is:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Double entry is a verification method — the two copies must match.
Trace tables and test data 测试数据
- A trace table records each variable's value as an algorithm runs — to check it works or to find out what it does.
- Test data types: normal (accepted), abnormal (rejected), extreme (largest/smallest allowed), boundary (the values on each side of a limit, e.g. 120 and 121).

Fill in a trace table
A trace table follows the variables one line at a time. Step through and watch the counter and the running total change — exactly the skill a trace-table exam question tests.
A trace table is used to:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Tracing helps you check an algorithm works, or work out what it does, by following the variables.
Trace total = 0; FOR i = 1 TO 5: total = total + i. What is total at the end?
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
1+2+3+4+5 = 15 — the value the trace table builds up row by row.
Worked example: test data for an exam mark
A program accepts whole-number exam marks from 0 to 100. Give one value of each type of test data.
- Normal: 57 (accepted). Abnormal: −8 or "ten" (rejected). Extreme: 0 and 100, the smallest and largest allowed values (accepted).
- Boundary: test each side of each limit: 100 (accepted) and 101 (rejected); 0 (accepted) and −1 (rejected). The check used is a range check, plus a type check for "ten".
A program accepts ages 18 to 65. Which pair is boundary test data for the upper limit?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Boundary data sits on each side of a limit: 65 should be accepted and 66 rejected.
Typing a new password twice is a validation check.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Double entry is verification: it checks the data was copied correctly, not that it is sensible.
You've got it
- validation = is it sensible? (range, length, type, presence, format, check digit)
- verification = was it copied correctly? (visual check, double entry)
- a trace table tracks variable values step by step
- test data: normal, abnormal, extreme, boundary