If Statement Exercises Part 2
What will the following conditions evaluate to?
int A = 5, B = -4, C = 0, D = 3;
bool apple = true, pear = false, cherry = true;
Number | Condition | Evaluates to |
1. | (A > B || C > D) | |
2. | (A > B && C > D) | |
3. | (!(A > C)) | |
4. | (A == B || C == D) | |
5. | ((B * -2) != (D + 5)) | |
6. | (A = 4 && D = 4) | |
7. | (A > 0 || B > 0 || C > 0 || D > 0) | |
8. | (!apple && !pear) | |
9. | (apple && pear && cherry) | |
10. | (!(A * 2 % D > 0) || !(C + B <= 0)) |
What will the following code output?
11. int Ferrari = 2, Bugatti = 1;
if (!(Ferrari > Bugatti))
{
Ferrari++; Bugatti--;
cout << Ferrari + Bugatti;
}
else
{
Ferrari--; Bugatti++;
cout << Ferrari + Bugatti:
}
12. float Pi = 3.1415, A = 2.2;
if (Pi < A || Pi < 0)
cout << "Yes";
cout << "No";