More Arithmetic: % and **

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

More Arithmetic: % and **

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Does % return the remainder of a division?
A No
B Yes
2. Does ** raise a number to a power?
A Yes
B No
3. Is ^ used for exponents in JavaScript?
A No
B Yes
4. Can % be used to check if a number is even?
A Yes
B No
5. Is 'mod' a valid JavaScript operator for remainder?
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
110 % 3 AWrong - use ** instead of ^ for exponents
22 ** 4 BRaises 2 to the power of 4
3Checks if a number divides evenly with no remainder CWrong - use % instead of the word mod
4Multiplies a number by itself repeatedly Dnum % 2 === 0
5console.log(10 mod 3); EReturns the remainder after dividing 10 by 3
6console.log(2 ^ 4); F3 ** 3

Definitions

%

Fill in the Blanks

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

1.
console.log(10 _ 3);
2.
console.log(2 __ 4);
3.
let remainder = 7 _ 2;
4.
let cube = 3 __ 3;
5.
let isEven = num _ 2 === 0;

Spot the Error

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

Question 1
A console.log(10 mod 3);
B console.log(10 % 3);
C console.log(2 ** 4);
Question 2
A console.log(2 ^ 4);
B console.log(2 ** 4);
C console.log(10 % 3);
Question 3
A let r = 9 % 4;
B let s = 9 // 4;
C let p = 2 ** 3;
Question 4
A let x = 5 % 2;
B let w = 5 pow 2;
C let z = 5 ** 2;
Question 5
A let a = 8 % 3;
B let b = 8 ** 2;
C let c = 8 %% 3;

Answer Key

More Arithmetic: % and **
Section A: Quick Questions
Q1
B — Yes
Q2
A — Yes
Q3
A — No
Q4
A — Yes
Q5
B — No
Section B: Match the Pairs
Q1
10 % 3 → Returns the remainder after dividing 10 by 3
Q2
2 ** 4 → Raises 2 to the power of 4
Q3
Checks if a number divides evenly with no remainder → num % 2 === 0
Q4
Multiplies a number by itself repeatedly → 3 ** 3
Q5
console.log(10 mod 3); → Wrong - use % instead of the word mod
Q6
console.log(2 ^ 4); → Wrong - use ** instead of ^ for exponents
Section C: Definitions
Q1
% — An operator that returns the remainder left over after dividing one number by another.
Section D: Fill in the Blanks
Q1
console.log(10 % 3);
Q2
console.log(2 ** 4);
Q3
let remainder = 7 % 2;
Q4
let cube = 3 ** 3;
Q5
let isEven = num % 2 === 0;
Section E: Spot the Error
Q1
A — Use %, not the word mod, for the remainder operator.
Q2
A — JavaScript uses ** for exponents, not ^.
Q3
B — Remainder uses %, not //, in JavaScript.
Q4
B — Exponents use **, not the word pow, in JavaScript.
Q5
C — The remainder operator is a single %, not %%.