Skip to main content

✍️ Practice (Logic)

1. Substitution​

Let x = true, y = false, z = false. What does the following expression evaluate to?

(x || y) && z

2. Substitution (Again)​

Let x = true, y = false, z = false. What does the following expression evaluate to?

! x && y || z

3. Substitution (Yet Again)​

Let x = true, y = false, z = false. What does the following expression evaluate to?

! (x && y || z)

4. Mixed Types​

What does false || 1 / (int) 3.7 < 3.5 evaluate to?

5. Mixed Types (Hard)​

Let int a = 7, double b = 2.5, bool flag = false. What does the following expression evaluate to?

!flag && (int) b * 3 > a / 2 + 4 || (double) a / 2 >= b + 1