Test Series - java

Test Number 20/64

Q: Which among the following is a Short Circuit OR operator?
A. &
B. &&
C. |
D. ||
Solution: Two Pipes ||
Q: What is the output of a Logical OR (|) operation if one of the inputs/operands is false?
A. false
B.  true
C. true or false
D. None of the above
Solution: Logical OR operator give true as output if at least one of the operands is true.
Q: What is the output of Logical AND (&) operation if one of the inputs/operands is false?
A. false
B. true
C. true or false
D. None of the above
Solution: false & (anything) is false.
Q: What is the output of a Logical OR (|) operation if one of the inputs/operands is true?
A. false
B. true
C. true or false
D. None of the above
Solution: true | (anything) is true.
Q: What is the output of a Logical AND (&) operation if one of the inputs/operands is true?
A. false
B. true
C. true or false
D. None of the above
Solution: true & (anything) = true or false
Q: What is the output of a Logical AND (&) operation if both inputs/operands are true?
A. false
B. true
C. true or false
D. None of the above
Solution: no solution
Q: What is the output of a Logical OR (|) operation if both the inputs/operands are true?
A. true
B. false
C. true or false
D. None of the above
Solution: no solution
Q: Which is fast among AND (&) and Short Circuit AND(&&) operators in Java?
A. AND operator
B. Short Circuit AND
C. Both work at the same speed
D. None of the above
Solution: no solution
Q: Which is fast among OR(|) and Short Circuit OR (||) operators in Java?
A. OR Operator
B. Short Circuit OR operator
C. Both work at the same speed
D. None of the above
Solution: no solution
Q: Why are Short Circuit AND (&&) and Short Circuit OR (||) operators are fast in Java?
A. By skipping the second expression or operand if possible and save time.
B. By using extra memory on the machine
C. By using extra CPU processing power
D. None of the above
Solution: Short Circuit operators are not 100% every time. Based on the value of the First operand, they decide whether to go evaluating the second expression.

You Have Score    /10