Basic Data Types

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

This Basic Data Types worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?

Basic Data Types

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does "Sam" represent a string data type?
A Yes
B No
2. Is 42 a number data type?
A No
B Yes
3. Is True (capital T) valid JavaScript boolean syntax?
A No
B Yes
4. Does removing quotes from text turn it into a variable reference?
A No
B Yes
5. Can a number data type include decimals like 9.99?
A Yes
B No

Match the Pairs

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

Left columnRight column
1"hello" AWrong - string values need quotes around them
2true B42
3A data type for whole or decimal numbers Cfalse
4A data type with two possible values: true or false DA string data type that holds text
5let name = Sam; EA boolean data type representing true or false
6let flag = True; FWrong - booleans use lowercase true/false

Definitions

string

Fill in the Blanks

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

1.
let age = __;
2.
let isReady = _____;
3.
let price = ____;
4.
let isDone = ____;
5.
let temp = __;

Spot the Error

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

Question 1
A let name = Sam;
B let age = 12;
C let ready = true;
Question 2
A let flag = True;
B let count = 5;
C let word = "Hi";
Question 3
A let age = 25;
B let city = Perth;
C let active = false;
Question 4
A let score = 10;
B let done = False;
C let title = "Hi";
Question 5
A let count = 3;
B let name = "Ana";
C let flag = yes;

Answer Key

Basic Data Types
Section A: Quick Questions
Q1
A — Yes
Q2
B — Yes
Q3
A — No
Q4
B — Yes
Q5
A — Yes
Section B: Match the Pairs
Q1
"hello" → A string data type that holds text
Q2
true → A boolean data type representing true or false
Q3
A data type for whole or decimal numbers → 42
Q4
A data type with two possible values: true or false → false
Q5
let name = Sam; → Wrong - string values need quotes around them
Q6
let flag = True; → Wrong - booleans use lowercase true/false
Section C: Definitions
Q1
string — A data type that holds text, written inside quotes like "hello".
Section D: Fill in the Blanks
Q1
let age = 12;
Q2
let isReady = false;
Q3
let price = 9.99;
Q4
let isDone = true;
Q5
let temp = -5;
Section E: Spot the Error
Q1
A — String values need quotes around them, like "Sam".
Q2
A — Booleans use lowercase true/false, not True.
Q3
B — String values need quotes around them, like "Perth".
Q4
B — Booleans use lowercase true/false, not False.
Q5
C — Booleans must be true or false, not yes.