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 integer division `7 / 2` in Java?
Answer: 3
Integer division in Java truncates the decimal portion, so 7 divided by 2 yields 3, not 3.5.
Which of the following is a valid enhanced for loop (for-each) in Java SE 11?
Answer: for(String s : stringArray) { }
The enhanced for loop syntax uses `for(Type variable : iterable)` and works with arrays and any Iterable collection.
Which operator performs a bitwise AND in Java?
Answer: &
The single `&` operator performs a bitwise AND on integer types, comparing each corresponding bit of two operands.
What is the value of `x` after executing `int x = 10; x -= 3; x *= 2;`?
Answer: 14
After `x -= 3`, x becomes 7; after `x *= 2`, x becomes 14.
Which statement correctly describes labeled `break` in Java?
Answer: It breaks out of the loop or block associated with the specified label
A labeled `break` exits the loop or block that is marked with the corresponding label, allowing breakout from nested loops.
What is the result of `!true && false` in Java?
Answer: false
`!true` evaluates to `false`, and `false && false` evaluates to `false` due to short-circuit evaluation.