0% found this document useful (0 votes)
10 views2 pages

Operators Evaluation Exercise

The document contains exercises on evaluating expressions using operators, divided into two sections. Section 1 focuses on evaluating boolean and arithmetic expressions with constants, while Section 2 involves variable manipulation and conditional statements using predefined variables a, b, and c. Each expression is to be evaluated step by step to determine the final output or value.

Uploaded by

efrem.gebrewahd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Operators Evaluation Exercise

The document contains exercises on evaluating expressions using operators, divided into two sections. Section 1 focuses on evaluating boolean and arithmetic expressions with constants, while Section 2 involves variable manipulation and conditional statements using predefined variables a, b, and c. Each expression is to be evaluated step by step to determine the final output or value.

Uploaded by

efrem.gebrewahd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Exercise on Operators

Section 1 — Constants Only


Instructions: Evaluate the following expressions step by step and write the final output
(True/False or number).
1. 5 + 2 > 6
2. 8 % 3 != 2
3. 6 - 4 < 3 || 2 + 1 == 3
4. 10 / 2 >= 5 && 3 * 2 != 6
5. 7 + 3 > 9 || !(4 + 2 == 6)
6. 5 * 2 == 10 && 12 % 5 != 2
7. 8 - 3 < 6 || 7 + 2 > 10 && 4 % 2 == 0
8. !(6 + 2 > 8) || 3 * 3 == 9
9. 10 - 4 > 5 && 6 + 1 < 8 || 3 * 2 == 6
10. 15 % 4 != 3 && 7 - 2 >= 5 || !(5 + 1 > 6)

Section 2
For each question, assume:
a = 4, b = 9, c = 2
Each question is independent — changes in one do not affect the next.
Write the final value of:
 a, b, c
 result (if used)
 flag (if used)
1. result = ++a + b--
2. result = a-- + ++c
3. flag = a + b > c
4. flag = a > b && b > c
5. flag = ++a < b || c-- > a
6. flag = a++ > b || ++c < b
7. result = a + b - c
8. result = a++ + --b + c--
9. flag = !(a > b) && c < b
10. result = ++a + b-- - c
11. result = (a + b > c) ? a : b
12. result = ++a > 5 ? a : b--
13. flag = a + b > c ? a > b : c < a

You might also like