Tugas Mandiri 04B
March27
1. Assuming that x is 1, show the result of the following Boolean expressions.
(true) && (3 > 4)
!(x > 0) && (x > 0)
(x != 1) == !(x == 1)
(x >= 0) || (x < 0)
Output dari soal diatas adalah :
(true) && (3 > 4) = False
!(x > 0) && (x > 0) = False
(x != 1) == !(x == 1) = True
(x >= 0) || (x < 0) = True
2. List the precedence order of the Boolean operators. Evaluate the following expressions :
- 2 * 2 – 3 > 2 && 4 – 2 > 5
- 2 * 2 – 3 > 2 || 4 – 2 > 5
Output dari soal diatas adalah :
-
2 * 2 – 3 > 2 && 4 – 2 > 5 = False
-
2 * 2 – 3 > 2 || 4 – 2 > 5 = False
3. Is (x > 0 && x < 10) the same as ((x > 0) && (x < 10))? Is (x > 0 || x < 10 && y < 0) the same as (x > 0 || (x < 10 && y < 0)) ?
-
Is (x > 0 && x < 10) dengan ((x > 0) && (x < 10)) Adalah Same
-
(x > 0 || x < 10 && y < 0) dengan (x > 0 || (x < 10 && y < 0)) Adalah Same