# Essential Mathematics - practice problems
*CS fundamentals 0*

## Overview
Complete each problem manually (i.e. using paper and pencil) and check your solution with the one provided for each problem below.

### Sorted items
For each of the following list of objects, share whether the objects are: *sorted in ascending order*, *sorted in descending order*, *unsorted*.

1. [<b>2, 4, 6, 8, 10</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    These numbers are sorted in ascending order.
    </details>
    </br>

1. [<b>-123, -42, -21, -9, 150, 2100</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    These numbers are sorted in ascending order.
    </details>
    </br>

1. [<b>"oranges", "kiwis", bananas", "apples"</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    These strings are sorted in alphabetically descending order.
    </details>
    </br>

1. [<b>-3, 705, "apples", 3.14</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    This is a list of unsorted objects.
    </details>
    </br>

1. [<b>32, 64, 16, 8, 128</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    These numbers are unsorted.
    </details>
    </br>

1. [<b>320, 230, 30, 20, 0</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    These numbers are sorted in descending order.
    </details>
    </br>

### Maximum and Minimum
For each of the following list of numbers, what is the <b>maximum value</b> and <b>minimum value</b>?

1. [<b>91, 42, 128, 47, 256, 19, 9, 254</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    Maximum value: 256</br>
    Minimum value: 9
    </details>
    </br>

1. [<b>14, 19, 17, 21, 15, 18</b>]
    <details><summary>click here to check your answer</summary>
    Maximum value: 21</br>
    Minimum value: 14
    </details>
    </br>

### Mean and Median
What is the <b>mean</b> and <b>median</b> for each of the following list of numbers?

1. [<b>5, 3, 1, 2, 9</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    Mean: 4 = (5 + 3 + 1 + 2 + 9) / 5 = 20/5 = 4</br>
    Median: 3 since it's the middle value.
    </details>
    </br>

1. [<b>19, 21, 14</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    Mean: 18 = (19 + 21 + 14) / 3 = 54/3 = 18</br>
    Median: 19
    </details>
    </br>

1. [<b>35, 30, 25, 10, 15, 20, 5</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    Mean: 20 = (35 + 30 + 25 + 10 + 15 + 20 + 5) / 3 = 140/7 = 20</br>
    Median: 20
    </details>
    </br>

1. [<b>3, 1, 2</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    Mean: 2 = (3 + 1 + 2) / 3 = 6/3 = 2</br>
    Median: 2
    </details>
    </br>

1. [<b>15, 4, 3, 2, 1, 9, 8, 7, 5</b>]
    <details>
    <summary>click here to check your answer
    </summary>
    Mean: 6 = (15 + 4 + 3 + 2 + 1 + 9 + 8 + 7 + 5) / 9 = 54/9 = 6</br>
    Median: 5
    </details>
    </br>

### Modulo and Divide
Considering integer division, for each of the following what would be the result?

1. 21 / 10
    <details>
    <summary>click here to check your answer
    </summary>
    21 / 10 = 2
    </details>
    </br>

1. 21 % 10
    <details>
    <summary>click here to check your answer
    </summary>
    21 % 10 = 1
    </details>
    </br>

1. 1234 / 100
    <details>
    <summary>click here to check your answer
    </summary>
    1234 / 100 = 12
    </details>
    </br>

1. 1234 % 100
    <details>
    <summary>click here to check your answer
    </summary>
    1234 % 100 = 34
    </details>
    </br>

1. 547210 / 10000
    <details>
    <summary>click here to check your answer
    </summary>
    547210 / 10000 = 54
    </details>
    </br>

1. 547210 % 10000
    <details>
    <summary>click here to check your answer
    </summary>
    547210 % 10000 = 7210
    </details>
    </br>

1. 65 / 2
    <details>
    <summary>click here to check your answer
    </summary>
    65 / 2 = 32
    </details>
    </br>

1. 65 % 2
    <details>
    <summary>click here to check your answer
    </summary>
    65 % 2 = 1
    </details>
    </br>

### Exponents and Logarithms
Solve the following problems related to exponents and logarithms.

1. 10<sup>5</sup>
    <details>
    <summary>click here to check your answer
    </summary>
    10<sup>5</sup> = 100000
    </details>
    </br>

1. 2<sup>2</sup>
    <details>
    <summary>click here to check your answer
    </summary>
    2<sup>2</sup> = 4
    </details>
    </br>

1. 2<sup>4</sup>
    <details>
    <summary>click here to check your answer
    </summary>
    2<sup>4</sup> = 16
    </details>
    </br>

1. 789<sup>0</sup>
    <details>
    <summary>click here to check your answer
    </summary>
    789<sup>0</sup> = 1
    </details>
    </br>

1. 2<sup>5</sup>
    <details>
    <summary>click here to check your answer
    </summary>
    2<sup>5</sup> = 32
    </details>
    </br>

1. 2<sup>8</sup>
    <details>
    <summary>click here to check your answer
    </summary>
    2<sup>8</sup> = 256
    </details>
    </br>

1. log<sub>2</sub> (256)
    <details>
    <summary>click here to check your answer
    </summary>
    log<sub>2</sub> (256) = 8
    </details>
    </br>

1. log<sub>2</sub> (64)
    <details>
    <summary>click here to check your answer
    </summary>
    log<sub>2</sub> (64) = 6
    </details>
    </br>

1. log<sub>2</sub> (8)
    <details>
    <summary>click here to check your answer
    </summary>
    log<sub>2</sub> (8) = 3
    </details>
    </br>

1. log<sub>2</sub> (1)
    <details>
    <summary>click here to check your answer
    </summary>
    log<sub>2</sub> (1) = 0
    </details>
    </br>

### Set theory basics
What is the intersection and union of the following two sets?

1. Set 1: {}, Set 2: {34, 73, 21}
    <details>
    <summary>click here to check your answer</summary>
    Intersection: {}</br>
    Union: {34, 73, 21}
    </details>
    </br>

1. Set 1: {61, 21, 19, 18}, Set 2: {78, 12, 16, 21}
    <details>
    <summary>click here to check your answer
    </summary>
    Intersection: {21}</br>
    Union: {12, 16, 18, 19, 21, 61, 78}
    </details>
    </br>

1. Set 1: {21, 12, 34, 43, 73, 37}, Set 2: {12, 21, 34, 37, 43, 73, 91}
    <details>
    <summary>click here to check your answer
    </summary>
    Intersection: {12, 21, 34, 37, 43, 73}</br>
    Union: {12, 21, 34, 37, 43, 73, 91}
    </details>
    </br>

1. Set 1: {2, 4, 6, 8, 10, 12}, Set 2: {3, 6, 9, 12, 15}
    <details>
    <summary>click here to check your answer
    </summary>
    Intersection: {6, 12}</br>
    Union: {2, 3, 4, 6, 8, 9, 10, 12, 15}
    </details>
