Multiple choice

Which of the following is a valid comparison?

  1. p=3;

  2. 3==p;

  3. p==3;

  4. both 1 and 2

  5. both 2 and 3

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Both of option (2) and (3) are valid comparison statements. The operator == checks if the values of two operands are equal or not, if yes then condition becomes true.