The Boolean operator for logical-and is:
2015
The Boolean operator for logical-and is:
- A.
&
- B.
&&
- C.
|
- D.
|&
- E.
Question not attempted
Attempted by 1177 students.
Show answer & explanation
Correct answer: B
In programming, different operators are used for bitwise and logical operations. The logical AND operator checks if both conditions are true and returns a Boolean result. The & symbol is a bitwise AND operator, which operates on individual bits of integers. It is not used for logical operations. The && operator is the standard logical AND operator in languages like C, C++, Java, and JavaScript. It evaluates the left operand first; if it is false, the right operand is not evaluated (short-circuiting). The | symbol is a bitwise OR operator, not a logical AND operator. The |& symbol is not a valid operator in standard programming languages. Therefore, the correct Boolean operator for logical AND is &&.