Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to correctly add 2 and 3, then multiply by 4.
Javascript
let result = (2 + 3) [1] 4; console.log(result);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of * causes the result to be 5 + 4 = 9, which is incorrect.
Using - or / changes the meaning and result unexpectedly.
✗ Incorrect
Multiplication (*) has higher precedence than addition (+), so (2 + 3) * 4 equals 20.
2fill in blank
mediumComplete the code to get the correct result of 2 + 3 * 4 without parentheses.
Javascript
let result = 2 + 3 [1] 4; console.log(result);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of * causes the operations to be done left to right, which is not correct here.
Using - or / changes the calculation and result.
✗ Incorrect
Multiplication (*) has higher precedence than addition (+), so 3 * 4 is done first, then 2 is added, resulting in 14.
3fill in blank
hardFix the error in the expression to get the correct result of 10 minus 2 times 3.
Javascript
let result = 10 [1] 2 * 3; console.log(result);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of - changes the result to 16.
Using * or / here changes the meaning and causes wrong results.
✗ Incorrect
Subtraction (-) is needed to get 10 - 2 * 3. Multiplication happens first, so 2 * 3 = 6, then 10 - 6 = 4.
4fill in blank
hardFill both blanks to create an expression that divides 20 by 5 and then adds 3.
Javascript
let result = 20 [1] 5 [2] 3; console.log(result);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the operators changes the result.
Using subtraction or multiplication instead of addition changes the meaning.
✗ Incorrect
Division (/) happens before addition (+), so 20 / 5 = 4, then 4 + 3 = 7.
5fill in blank
hardFill all three blanks to create an expression that multiplies 4 by 3, subtracts 2, then adds 5.
Javascript
let result = 4 [1] 3 [2] 2 [3] 5; console.log(result);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Changing the order of operators changes the result.
Using division instead of multiplication changes the meaning.
✗ Incorrect
Multiplication (*) happens first: 4 * 3 = 12, then subtraction (-) 12 - 2 = 10, then addition (+) 10 + 5 = 15.