Data dictionary

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Data dictionary

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which best describes a data dictionary?
A A list of Python keywords and what each one does
B A table documenting each data element's name, type, format, description and validation
2. In a data dictionary, how many rows are usually used for each variable or field?
A One row per variable or field
B One row for all the variables together
3. Which column would hold the value 'Must be between 0 and 100'?
A Data type
B Validation
4. Which data dictionary entry for a field called studentName has the correct data type?
A studentName | String
B studentName | Boolean
5. Why do programmers and testers use a data dictionary?
A So everyone uses and checks each piece of data the same way
B So the program runs faster on the computer

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Name | Data type | Format | Description | Example | Validation AOne complete data dictionary row that documents the studentAge variable
2studentAge | Integer | 2 digits | Age in years | 15 | Whole number from 12 to 19 BThe column headings of a data dictionary, with one row for each variable or field
3The data type column tells the programmer how to declare and store the value (text, whole number, decimal, date or Boolean) CThe example value is a decimal, but the data type is Integer. The example must match the data type, for example 3.
4The validation column gives a rule that supports testing, because testers can build test data that passes and fails it DName: ticketPrice | Data type: Floating point
5Name: x | Data type: Text | Description: (blank) EThe name is vague and the description is missing, so other developers cannot tell what the data element is for. Use a meaningful name like studentName and write a clear description.
6Name: quantity | Data type: Integer | Example: 2.5 FValidation: Range 0 to 100 | Test with 0, 100, -1, 101

Definitions

data dictionary

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Name | Data type | Example | __________
2.
Name: studentAge Data type: _______ Validation: range 12 to 18
3.
Name: dateOfBirth Format: __________ Example: 25/03/2008
4.
Name: password Data type: String Validation: length __ 8
5.
Name: postcode Size: _ characters Example: 3000

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Name: studentAge
B Data type: Integer
C Example: fifteen
D Validation: 5 to 18
Question 2
A Name: isEnrolled
B Data type: Boolean
C Format: True or False
D Example: 25
Question 3
A Name: postcode
B Data type: String
C Format: 4 digits
D Validation: must be 4 letters
E Example: 3000
Question 4
A # age: Integer, 5 to 18
B age = int(input('Age: '))
C if age > 5 or age < 18:
D print('Invalid age')
Question 5
A Name | Type | Example
B score | Integer | 87.5
C price | Float | 4.50
D isPaid | Boolean | True

Answer Key

Data dictionary
Section A: Quick Questions
Q1
B — A table documenting each data element's name, type, format, description and validation
Q2
A — One row per variable or field
Q3
B — Validation
Q4
A — studentName | String
Q5
A — So everyone uses and checks each piece of data the same way
Section B: Match the Pairs
Q1
Name | Data type | Format | Description | Example | Validation → The column headings of a data dictionary, with one row for each variable or field
Q2
studentAge | Integer | 2 digits | Age in years | 15 | Whole number from 12 to 19 → One complete data dictionary row that documents the studentAge variable
Q3
The data type column tells the programmer how to declare and store the value (text, whole number, decimal, date or Boolean) → Name: ticketPrice | Data type: Floating point
Q4
The validation column gives a rule that supports testing, because testers can build test data that passes and fails it → Validation: Range 0 to 100 | Test with 0, 100, -1, 101
Q5
Name: x | Data type: Text | Description: (blank) → The name is vague and the description is missing, so other developers cannot tell what the data element is for. Use a meaningful name like studentName and write a clear description.
Q6
Name: quantity | Data type: Integer | Example: 2.5 → The example value is a decimal, but the data type is Integer. The example must match the data type, for example 3.
Section C: Definitions
Q1
data dictionary — A table listing each data element with its name, data type, size or format, description and validation rule, so everyone uses the data the same way when coding and testing.
Section D: Fill in the Blanks
Q1
Name | Data type | Example | Validation
Q2
Name: studentAge Data type: Integer Validation: range 12 to 18
Q3
Name: dateOfBirth Format: DD/MM/YYYY Example: 25/03/2008
Q4
Name: password Data type: String Validation: length >= 8
Q5
Name: postcode Size: 4 characters Example: 3000
Section E: Spot the Error
Q1
C — The example must match the data type. An Integer field needs a whole number such as 15, not the word fifteen. Fix: Example: 15
Q2
D — A Boolean field can only hold True or False, so the example 25 does not match the data type or the format. Fix: Example: True
Q3
D — The validation rule contradicts the format. The format says 4 digits, so the rule should check the length is 4, not that it is made of letters. Fix: Validation: length must be 4
Q4
C — The data dictionary says age must be 5 to 18. The invalid test must catch values below 5 or above 18, so the operators are the wrong way round. Fix: if age < 5 or age > 18:
Q5
B — The score is listed as an Integer, so its example must be a whole number. 87.5 is a floating point value. Fix: score | Integer | 87