Course Test · School: elementary and middle
Grades K–2: number sense and early arithmetic: RatMath answers
The same twenty exercises, answered with RatMath Core and the Shelf libraries only. The code below was run when this page was built; its output is shown as printed, and compared with the independent answer.
Agrees 20
Libraries used here: core, stats. In this code each library is in scope under its own name (linalg.det, stats.tTest), and Core's names (R, Rational, …) are in scope directly.
- 1.Skip countingAgreesCount by fives from 35 to 60.Independent answer35, 40, 45, 50, 55, 60RatMath code
range(35, 60, 5)Output[35, 40, 45, 50, 55, 60]
- 2.Addition factsAgreesIndependent answer15 (make a ten: ).RatMath code
R`8 + 7`Output15
- 3.Subtraction within 100AgreesIndependent answer35 (, then add back 2).RatMath code
R`63 - 28`Output35
- 4.Addition within 1000AgreesIndependent answer605 (, , ; ).RatMath code
R`347 + 258`Output605
- 5.Subtraction across zerosAgreesIndependent answer326 (, add back 24).RatMath code
R`502 - 176`Output326
- 6.Place valueAgreesIn the number 486, what is the value of the digit 8?Independent answer80 (eight tens).RatMath code
const n = new Integer(486n); [n.digits(), n.digitAt(1), n.placeValue(1)]Output[[4, 8, 6], 8, 80]
digits,digitAtandplaceValueread the places directly (k = 0 is ones, 1 tens).Fix: ratmath/core#15,digits/placeValue, US coins,toClock(itsroundIntegerwas folded intoroundin Core 0.12) - 7.Comparing numbersAgreesWhich is greater, 309 or 390? Write the comparison with or .Independent answer.RatMath code
R`309`.lessThan(R`390`)Outputtrue
- 8.RoundingAgreesRound 65 to the nearest ten.Independent answer70 (a 5 in the ones place rounds up).RatMath code
new Rational(65n).roundTo(-1)Output70
Since Core 0.12 rounding defaults to half up, the school rule, so 65 goes to 70. Other conventions are one argument away (roundTo(-1, "half-even")gives 60), andround()returns a Core Integer, so.multiplycan follow.Fix: ratmath/core#16, Core 0.12:round/floor/ceil/truncreturn Integers, rounding defaults to half up,rounding(mode)rounders - 9.Even and oddAgreesIs 37 even or odd?Independent answerOdd.RatMath code
R`37`.isOdd()Outputtrue
- 10.Two-step word problemAgreesMaria has 14 stickers. She gives 6 to her brother and then gets 9 more from a friend. How many stickers does she have now?Independent answerstickers.RatMath code
R`14 - 6 + 9`Output17
- 11.MoneyAgreesHow many cents are 3 quarters, 2 dimes and 4 pennies?Independent answercents.RatMath code
units.Q("3 quarter").add(units.Q("2 dime")).add(units.Q("4 penny")).to("cent")Output99 cent
The units catalogue has US money:USD,centand the coins.Fix: ratmath/core#15,digits/placeValue, US coins,toClock(itsroundIntegerwas folded intoroundin Core 0.12) - 12.TimeAgreesWhat time is it 45 minutes after 2:30?Independent answer3:15.RatMath code
units.Q("150 min").add(units.Q("45 min")).toClock({ wrap: 12 }) // 2:30 is 150 min after 12:00Output3:15
toClockwrites a duration as clock time, exactly;wrap: 12reads it as a time of day.Fix: ratmath/core#15,digits/placeValue, US coins,toClock(itsroundIntegerwas folded intoroundin Core 0.12) - 13.Fractions of a wholeAgreesA pizza is cut into 4 equal pieces. Sam eats 3 pieces. What fraction of the pizza did Sam eat?Independent answer.RatMath code
R`3/4`Output3/4
- 14.LengthAgreesA pencil is 7 inches long and a crayon is 4 inches long. How much longer is the pencil?Independent answer3 inches.RatMath code
units.Q("7 in").subtract(units.Q("4 in"))Output3 in
- 15.Equal groupsAgreesThere are 4 rows of chairs with 5 chairs in each row. How many chairs are there?Independent answer.RatMath code
R`4 * 5`Output20
- 16.Missing addendAgrees. What number goes in the box?Independent answer7.RatMath code
R`16 - 9`Output7
- 17.Number lineAgreesWhat number is halfway between 30 and 50 on a number line?Independent answer40.RatMath code
R`(30 + 50)/2`Output40
- 18.ShapesAgreesHow many sides do 3 triangles and 2 squares have altogether?Independent answer.RatMath code
R`3*3 + 2*4`Output17
- 19.Tens and onesAgreesWhat number is 5 tens and 13 ones?Independent answer.RatMath code
R`5*10 + 13`Output63
- 20.Picture graphAgreesA class graph shows 5 cats, 8 dogs and 3 fish as pets. How many pets are there in all, and how many more dogs than fish?Independent answer16 pets in all; 5 more dogs than fish.RatMath code
const pets = { cats: 5, dogs: 8, fish: 3 }; [stats.sum(Object.values(pets)), R`${pets.dogs} - ${pets.fish}`]Output[16, 5]