1.

The snippet that has to be used to check if “a” is not equal to “null” is _________(a) if(a!=null)(b) if (!a)(c) if(a!null)(d) if(a!==null)

Answer» Correct option is (d) if(a!==null)

To explain: A strict comparison (e.g., ===) is only true if the operands are of the same type and the contents match. The more commonly-used abstract comparison (e.g. ==) converts the operands to the same type before making the comparison. The not-equal operator !== compares 0 to null and evaluates to either true or false.


Discussion

No Comment Found

Related InterviewSolutions