Math Expressions: eliminating ambiguity Flashcards

1
Q

calculatedNum = 2 + (2 * 6);

What is the value of calculatedNum?

A

14

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

calculatedNum = (2 + 2) * 6;

What is the value of calculatedNum?

A

24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

calculatedNum = (2 + 2) * (4 + 2);

What is the value of calculatedNum?

A

24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

calculatedNum = ((2 + 2) * 4) + 2;

What is the value of calculatedNum?

A

18

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write a statement that assigns to num the result of 10 + 2 * 4, clarified with parentheses, producing 18. The variable hasn’t been declared beforehand.

A

var num = 10 + (2 * 4);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Write a statement that assigns to cost the result of 2 + 2 * 4 + 10, clarified with parentheses, producing 56. The variable hasn’t been declared beforehand.

A

var cost = (2 + 2) * (4 + 10);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Write a statement that assigns to units the result of 2 + 2 * 4 + 10, clarified with parentheses, producing 20. The variable hasn’t been declared beforehand

A

var units = 2 + (2 * 4) + 10;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Write a statement that assigns to pressure the result of 4 / 2 * 4, clarified with parentheses, producing .5. The variable hasn’t been declared beforehand.

A

var pressure = 4 / (2 * 4);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Write a statement that assigns to pressure the result of 4 / 2 * 4, clarified with parentheses, producing 8. The variable hasn’t been declared beforehand.

A

var pressure = (4 / 2) * 4;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Write a statement that assigns to a variable the result of adding two variables together and then afterward multiplying the result of the addition by another variable. The first variable has been declared beforehand.

A

cost = (foodCost + laborCost) * multiplier;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Write a statement that assigns to a variable the result of 4 / 2 * 4 - 1, clarified with parentheses, producing -.5. The variable hasn’t been declared beforehand.

A
var x = (4 / (2 * 4)) - 1;
or
var x = 4 / (2 * 4) - 1;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly