Math Operators Quiz
docx
keyboard_arrow_up
School
Florida Atlantic University *
*We aren’t endorsed by this school
Course
COP3450
Subject
Mathematics
Date
Jan 9, 2024
Type
docx
Pages
4
Uploaded by AgentAnteaterPerson953
Math Operators in Programming Quiz
Highlight answers and submit as a PDF.
1.
Evaluate the Python expressions below to determine the output.
-3.0
1.0
-2.0
40
a.
print(18 / 2 - 4 * 3)
b.
print(5 / 5 * 8 / 8)
c.
print(6 * 4 / 3
+ 5 - 10 * 2 + 5)
d.
print((8 - 4) * 10)
2.
Evaluate the AP pseudocode statements below to determine the output.
59.333333333333336
97.0
25.704545454545453
20.4
a.
DISPLAY(5 + 4 / 3 - 7 + 3 * 20)
b.
DISPLAY(10 * 10.0 - 3)
c.
DISPLAY(40.5 – 20.25 + 20 / 11 * 3)
d.
DISPLAY(8 / 4 * 10.2)
3.
What value will output?
14.0
answer = (4 * 12 / ( (9 + 3) / 3) ) + 2
print(answer)
4.
Evaluate the following Python code:
5.98
a = 2.65
b = 10
c = 3
e = a + b / c
print(e)
5.
Evaluate the expressions below using the variables given:
60
-6.0
30.0
3.0
0.0
70.0
4.0
-18.0
Undefined (infinity)
a = 6
b = -2
c = 12.0
a.
a * 10
b.
c / b
c.
a + c – a * b
d.
c / 12 * 3
e.
c / c - 1
f.
b + c * a
g.
a / -3 + b * c / - 3 + b
h.
a * (b + 2) - b - (b + c) * 2
i.
c * b / 0
6.
Evaluate each AP pseudocode expression.
1.2857
26
50.0
82
150
m ← 5 + 13
n ← 21 - 7
a.
m / n
b.
2 + 6 * (m - n)
c.
m / 3 + 22 * 2
d.
(n * 2) + (m * 3)
e.
m * 10 – 30
7.
Evaluate the following AP pseudocode.
x=54/3
y=7*2
print(x+y)
8.
Evaluate the value of
f, g, h
, and
i
if
a, b, c
and
d
have following values.
You may assume that the variables
f, g, h,
and
i
all have the value 0
stored in them.
a = 2
b = 6
c = 7
d = 3
a.
f += a - b
b.
g /= c * 2
c.
h -= b + d
d.
i *= d / 2
-4
0.0
-9
0.0
9.
Evaluate the following expressions and provide the output given the initialized
variables below:
26.4
9.10
132.3
0.7558
val = 8
val2 = 10
val3 = 2.1
val4 = 6.3
a.
sum = val + val2
sum += val3 + val4
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
print(sum)
b.
sub = val3 + 25 - 10
sub -= val
print(sub)
c.
product = val3 * val4
product *= val2
print(product)
d.
quotient = val2 / val3
quotient /= val4
print(quotient)
10.The code segment below is continuous. Determine what prints out along the way
at each output statements.
val = 2
val2 = 4
val3 = 5.0
a.
print("Val =", val)
val2 -= 1
val3 += 3
answer:
Val =2
b.
print("Val =", val, "Val2 =", val2, "Val3 =", val3)
val *= val3
val3 += 2
answer: Val =2, Val2 =3, Val3 =8.0