1Z0-811 Java Operators and Control Flow Flashcards
6 cards from real 1Z0-811 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 1Z0-811 Java Operators and Control Flow flashcards as text
What is the result of the expression `10 % 3` in Java?
Answer: 1
The `%` operator returns the remainder of integer division, so 10 divided by 3 leaves a remainder of 1.
Which operator is used for short-circuit logical AND in Java?
Answer: &&
The `&&` operator performs a short-circuit logical AND, meaning the second operand is not evaluated if the first is false.
What is the output of `int x = 5; System.out.println(x++);`?
Answer: 5
The post-increment operator `x++` returns the current value of x (5) before incrementing it to 6.
Which control flow statement is used to exit the current iteration of a loop and proceed to the next?
Answer: continue
The `continue` statement skips the rest of the current loop iteration and jumps to the loop condition check for the next iteration.
What is the result of `true || false && false` in Java?
Answer: true
Due to operator precedence, `&&` is evaluated before `||`, so the expression becomes `true || (false && false)` = `true || false` = `true`.
Which of the following is the ternary operator syntax in Java?
Answer: condition ? valueIfTrue : valueIfFalse
The ternary operator syntax is `condition ? valueIfTrue : valueIfFalse`, returning the first value when condition is true.