# 09 - Exponentiation, MOD, DIV

1. Watch this video if possible. Fill in the blanks.
`Please Excuse My Dear Aunt Sally: Parentheses come first, followed by ___________, then Multiplication and Division from left to right, and finally Addition and Subtraction from left to right.`

ex numbers

external division

exponents

experience

2. If we take the number 10 and divide it by 3 we get three and a third.

TRUE

FALSE

3. DIV is different. DIV means that you only get an _________ and any fraction is ignored and rounded. 10 DIV 3 = 3

exponent

unexpected variable

interruption

integer

4. With the modulo operator we get the remainder from the division. 10 MOD 3 = ____
`Note: Watch the video that shows the application of MOD if you are able to. Knowing how MOD is used in programming will be very important.`

2

4

1

3

5. Evaluate the following arithmetic expression where a=3, b=4, c=5 ..
`a^b`

34

22

81

6. Evaluate the following arithmetic expression where a=3, b=4, c=5 …
`(c-a)^b`

15

12

16

18

7. Evaluate the following arithmetic expression where a=3, b=4, c=5 ….
`8*(a+c)/b`

12

18

21

16

8. Evaluate the following arithmetic expression where a=3, b=4, c=5 ….
`(a+b)*(b-c)/(c-a)`

100

31.5

12.5

30.5

9. Evaluate the following arithmetic expression where a=3, b=4, c=5 …..
`(b+c)/a*b`

12

10

9

11

10. What does the following algorithm do?
```Input x,y
C=x MOD y
D=x DIV y
OUTPUT C,D```

input two numbers (x and y). Using MOD and dividing this by DIV C, output the result of the sum of x + Y

input two numbers (x and y). Using MOD and DIV output the whole number part and the remainder for dividing X by Y.

none of the above

input two letters, x and y. Using MOD and DIV, input the whole number and divide x by y

11. What is the output of Z for the following algorithm, when the following numbers are input. A=27, B=15, C=52.
`Z=A MOD 8`

6

7

3

5

12. What is the output of Z for the following algorithm, when the following numbers are input. A=27, B=15, C=52.
`Z=C DIV B`

3

5

7

6

13. What is the output of Z for the following algorithm, when the following numbers are input. A=27, B=15, C=52.
`Z=(A MOD 13)+C`

6

5

7

53

14. What is the output of Z for the following algorithm, when the following numbers are input. A=27, B=15, C=52.
`Z=(88 MOD B)  DIV (A MOD 5)`

2

6

3

8

15. The code below is for a Binary Search (in python). Where has DIV been used here?
```def binary_search(list, int):
high = len(list)-1
low = 0

while low <= high:
mid = (high + low) // 2
guess = list[mid]
if guess > int:
high = mid -1
elif guess < int:
low = mid + 1
else:
return ('{} found in list at position {}'.format(int, mid))
return None

print(binary_search([12,15,19,23,27,29], 27))```

It hasn't

On the line that says: "If guess > int:"

On the line that says: mid = (high + low) //2

Straight forward division (/) has been used but not DIV