1.
Arithmetic Operators:
Given: int a = 15; and int b = 4;
What are the values of:
* a / b
* a % b
* (double) a / b
2. Relational Operators:
Given: int a = 15; and int b = 4;
What is the boolean result of each expression?
* a > b
* a == b
* a != b
* a <= 15
3. Logical Operators:
Given: boolean isJavaFun = true; and boolean isCoffeeHot = false;
What is the boolean result of each expression?
* isJavaFun && isCoffeeHot
* isJavaFun || isCoffeeHot
* !isJavaFun
4. Increment/Decrement Operators:
What is the final value of j?
int i = 5;
int j = ++i;
What is the final value of k?
int i = 5;
int k = i++;
5. Assignment Operators:
Given: int x = 10;
What is the value of x after the following operations?
* x += 5;
* x -= 2;
* x *= 3;
6. Operator Precedence:
What is the value of result?
int result = 10 + 2 * 5 - 12 / 3;
7. Conditional (Ternary) Operator:
What is the value of message?
int age = 18;
String message = (age >= 18) ? "You can vote." : "You cannot vote.";
8. Bitwise Operators:
Given: int x = 10; and int y = 5;
What is the value of:
* x & y
* x | y
* x ^ y
9. Type Casting:
What is the output of the following code?
double myDouble = 123.456;
int myInt = (int) myDouble;
[Link](myInt);
10. Combined Operators:
What is the final value of total?
int total = 100;
total /= 10;
total++;
total %= 3;