Term
|
Definition
| Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. |
|
|
Term
| How many Operator ranks are there and what are they (in their ranking order)? |
|
Definition
14 (fourteen) ranks
1: postfix unary; 2: prefix unary; 3: multiplicative; 4: additive; 5: shift;
6: relational; 7: equality; 8: bitwise AND; 9: bitwise exclusive OR;
10: bitwise inclusive OR; 11: logical AND; 12: logical OR; 13: ternary; 14: assignment |
|
|
Term
| What does the phrase Operator Precedence mean? |
|
Definition
| Operator Precedence refers to the fact that binary operators (+ - & etc) are in fourteen ranked bands. When two operators of differing rank exist within the same clause of a block of logic, they will be performed at run-time in the order of their rank, descending. |
|
|
Term
| In the event that all of the operators in an expression are of the same rank, how is the order of execution determined? |
|
Definition
| All binary operators except for the assignment operators are evaluated from left to right; assignment operators are evaluated right to left. |
|
|
Term
| How many assignment operators are there and what are they? |
|
Definition
| There are 12 assignment operators: equals (=), plus equals (+=), minus equals (-=), times equals (*=), divided by equals (/=), remainder or mod equals (%=), bitwise AND equals (&=), bitwise exclusive OR equals (^=), bitwise inclusive OR equals (|=), signed left shift equals (<<=), signed right shift equals (>>=), unsigned right shift equals (>>>=). |
|
|
Term
| How many categories of operators are there and what are they? |
|
Definition
| There are 8 different categories: 1: assignment, 2: arithmatic, 3: unary, 4: equality, 5: relational, 6: conditional, 7: bitwise and 8: bit shift |
|
|
Term
| What is the operator which is used for concatenating a String object? |
|
Definition
|
|
Term
| What is the phrase used to describe the combination of a simple assignment operator with either an arithmetic, bitwise or bit shift operator? |
|
Definition
| A simple assignment operator combined with either an arithmetic, bitwise or bit shift operator is referred to as a compound assignment. |
|
|
Term
| What is the "!" operator called, to which category does it belong and what function does it perform? |
|
Definition
| The "!" operator is called a logical complement operator. It is a member of the Unary category and it inverts the value of a boolean. |
|
|
Term
| What is the name and symbol of the unary operator that negates the product of an expression that returns a numeric value? |
|
Definition
| The unary minus operator ("-") negates an expression. |
|
|
Term
What are the four outputs from the following method:
class PrePostDemo {
public static void main(String[] args){
int i = 3;
i++;
System.out.println(i);
++i;
System.out.println(i);
System.out.println(++i);
System.out.println(i++);
System.out.println(i);
}
} |
|
Definition
class PrePostDemo {
public static void main(String[] args){
int i = 3;
i++;
System.out.println(i); // prints 4
++i;
System.out.println(i); // prints 5
System.out.println(++i); // here i = 5, is incremented to 6 and then printed
System.out.println(i++); // here i = 6, is printed and then incremented.
System.out.println(i); // prints 7
}
} |
|
|
Term
| An operator performs specific operations on one, two or three __________. |
|
Definition
| An operator performs specific operations on one, two or three operands. |
|
|
Term
| How many one operand operators are there and what category(ies) are they in? |
|
Definition
| There are eight one operand operators and they are all within the unary category (hence the name). |
|
|
Term
| How many three operand operators are there and to which category do they belong? |
|
Definition
| There is only one three operand operator, called the ternary operator ( ? : ), which is within the conditional operators category. |
|
|
Term
| Which operator is evaluated first, bitwise AND ("&") or logical AND ("&&")? |
|
Definition
| Bitwise AND evaluates before Logical AND. |
|
|
Term
| Which operator is evaluated first, bitwise inclusive OR ("|") or bitwise exclusive OR ("^")? |
|
Definition
| Bitwise exclusive OR ("^") evaluates before bitwise inclusive OR ("|"). |
|
|
Term
| What is the only non-symbolic operator? |
|
Definition
| The operator instanceof is the only non-symbolic operator. |
|
|
Term
| How does the instanceof operator function? |
|
Definition
| The instanceof operator takes two operands, the preceding operand being the class instance being evaluated and the succeeding operand being the class to which the class instance is being compared. If operand 1 is of the same class, of a child class, or and implementation of operand 2, the expression will evaluate to true. |
|
|
Term
| To what category and rank does the instanceof operator belong? |
|
Definition
| Instanceof belongs to the Relational category, as well as the rank of the same name. |
|
|
Term
| How many unary bitwise operators are there and what are they? |
|
Definition
| There is only one unary bitwise operator, the unary bitwise complement operator ("~"). This operator inverts a bit pattern, making every "0" a "1" and every "1" a "0". |
|
|
Term
| What is the syntax for performing a single position bitwise signed left shift on the variable X and assigning it to the variable Y?? |
|
Definition
|
|
Term
| What is the difference between an inclusive OR and an exclusive OR operation? |
|
Definition
An inclusive OR operation will evaluate to true if either of it's operands is 'true', which is all scenarios except 'false' - 'false'.
An exclusive OR operation will only evaluate to true if only one of the operands is 'true'. The only difference between exclusive and inclusive then is that exclusive will return 'false' if both operands are 'true'. |
|
|