What a data type is

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

What a data type is

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What is a data type?
A The speed a computer runs at
B The kind of data a value is, like a number or text
2. Which of these is a data type used in this unit?
A True/false
B Loud/quiet
3. The data type of a value decides...
A What the computer can do with that value
B What colour the screen is
4. The number 5 and the text "5" look the same, so they are the same data type.
A False: one is a number and one is text
B True: they both show a 5
5. Which value is text?
A true
B "hello"

Match the Pairs

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

Left columnRight column
1data type AValues have different data types such as number, text or true/false, and the type decides what the computer can do.
2"5" BText type: the character 5 in quote marks, not a number you can add up
3A whole number is one of the three data types in this unit, and you can do sums with it CThe kind of data a value is, such as a number, text or true/false
4A true/false value is a data type with only two possible values D5 + 2
5"5" is a number because it has a 5 in it ETrue
6All values are the same type, so the computer can do the same things with them FThe quote marks make "5" text. A value's type is decided by the kind of data it is, not just by how it looks.

Definitions

data type

Fill in the Blanks

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

1.
print(____(5))
2.
score = 5 print(type(_____))
3.
The data type of "5" is ____
4.
The data type of TRUE is __________
5.
5 and "5" look the same. They have _________ data types.

Spot the Error

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

Question 1
A score ← 42
B type of score is text
C score ← score + 1
Question 2
A isHappy ← true
B count ← 3
C type of isHappy is number
Question 3
A city ← Perth
B type of city is text
C show city
Question 4
A price ← 8
B tax ← "2"
C total ← price + tax
Question 5
A ready ← "true"
B type of ready is true/false
C show ready

Answer Key

What a data type is
Section A: Quick Questions
Q1
B — The kind of data a value is, like a number or text
Q2
A — True/false
Q3
A — What the computer can do with that value
Q4
A — False: one is a number and one is text
Q5
B — "hello"
Section B: Match the Pairs
Q1
data type → The kind of data a value is, such as a number, text or true/false
Q2
"5" → Text type: the character 5 in quote marks, not a number you can add up
Q3
A whole number is one of the three data types in this unit, and you can do sums with it → 5 + 2
Q4
A true/false value is a data type with only two possible values → True
Q5
"5" is a number because it has a 5 in it → The quote marks make "5" text. A value's type is decided by the kind of data it is, not just by how it looks.
Q6
All values are the same type, so the computer can do the same things with them → Values have different data types such as number, text or true/false, and the type decides what the computer can do.
Section C: Definitions
Q1
data type — The kind of data a value is, such as a number, text or true/false. The data type decides what the computer can do with the value.
Section D: Fill in the Blanks
Q1
print(type(5))
Q2
score = 5 print(type(score))
Q3
The data type of "5" is text
Q4
The data type of TRUE is true/false
Q5
5 and "5" look the same. They have different data types.
Section E: Spot the Error
Q1
B — 42 is a whole number, so its data type is number, not text. The line should say: type of score is number.
Q2
C — The value true is a true/false value, not a number. The line should say: type of isHappy is true/false.
Q3
A — Text must be written inside quotes. Without quotes, Perth is not a text value. It should be city ← "Perth".
Q4
B — Quotes make "2" text, so it can't be added like a number. Write tax ← 2 so that price + tax works as maths.
Q5
A — Quotes turn true into text. A true/false value is written without quotes: ready ← true.