Math Quiz: Math for - Nested Conditional Statements

  1. Reactor Safety System: A safety system for a chemical reactor monitors temperature $T$ (in $^{\circ}$C) and pressure $P$ (in kPa). The system follows these rules:

    • First, it checks if $T < 150^{\circ}$C.
    • If $T < 150^{\circ}$C is true, it then checks if $P < 1000$ kPa.
      • If $P < 1000$ kPa is also true, the system state is 'Stable'.
      • Else (if $P \geq 1000$ kPa), the system state is 'Warning: High Pressure'.
    • Else (if $T \geq 150^{\circ}$C), the system state is 'Danger: High Temperature'.

    Determine the system state for:

    1. $T = 120^{\circ}$C, $P = 900$ kPa

    2. $T = 140^{\circ}$C, $P = 1100$ kPa

    3. $T = 160^{\circ}$C, $P = 950$ kPa

  2. Automated Irrigation System: An automated irrigation system waters a field based on soil moisture $M$ (as a percentage) and the probability of rain $R$ (as a percentage) in the next 24 hours. The rules are:

    • If $M < 30\%$:
      • If $R < 20\%$, water for 60 minutes.
      • Else (if $R \geq 20\%$), water for 30 minutes.
    • Else if $M \geq 30\%$ and $M \leq 60\%$:
      • If $R < 50\%$, water for 15 minutes.
      • Else (if $R \geq 50\%$), do not water.
    • Else ($M > 60\%$):
      • Do not water.

    Determine the watering time if:

    1. Soil moisture is $25\%$ and probability of rain is $10\%$.

    2. Soil moisture is $40\%$ and probability of rain is $60\%$.

    3. Soil moisture is $20\%$ and probability of rain is $30\%$.

  3. Conditional Logic Evaluation: Let $x, y$ be integers. Consider the conditions: C1: $x > 0$
    C2: $y < x$
    C3: $x \text{ is even}$
    An item's inspection follows these rules:

    • If C1 is false, the outcome is 'Fail: C1'.
    • Else (C1 is true):
      • If C2 is false, the outcome is 'Fail: C2'.
      • Else (C2 is true):
        • If C3 is false, the outcome is 'Fail: C3'.
        • Else (C3 is true), the outcome is 'Pass'.

    Determine the outcome for:

    1. $x = 4, y = 2$

    2. $x = 5, y = 3$

    3. $x = -2, y = -5$

    4. $x = 6, y = 8$

  4. Compound Statement Truth Value: Evaluate the truth of the statement:
    "If ($A > 5$ AND $A < 15$), then ($A \text{ is even}$ OR $A \text{ is a multiple of } 3$)"
    for the following integer values of $A$:

    1. $A = 6$

    2. $A = 7$

    3. $A = 10$

    4. $A = 4$ (Hint: An "If P, then Q" statement is true if P is false.)

  5. Number Classification Logic: A number $N$ is classified based on two properties:

    1. Is $N$ a multiple of 5? (Let this be P1)
    2. Is $N$ less than 20? (Let this be P2)

    Describe a set of rules using a nested "If...Then...Else..." structure to classify $N$ into one of four categories. Your description should clearly show the decision-making process, for example, by first checking P1, and then based on that result, checking P2.

    • Category Alpha: P1 is true AND P2 is true.
    • Category Beta: P1 is true AND P2 is false.
    • Category Gamma: P1 is false AND P2 is true.
    • Category Delta: P1 is false AND P2 is false.