Boolean evaluates TRUE and FALSE statements. Usually 0 represents FALSE and 1 represents TRUE. So the last statement reads TRUE AND TRUE EVALUATES TO TRUE, which is the right answer.
It’s just “rules” just like how you know what to do in maths when two numbers are added or multiplied. Decimal is normal math so 1+1=2, Binary is 1s and 0s and the rule is that when 1 gets added to 1 it’s 0 and the 1 gets carried over to the left. The number you get ISNT 10 (ten) it’s binary 2! In that sense if you took binary 10 (two) and added 10 (two) you get 100 (four) an easy way to convert binary to decimal numbers is each place of the number from the right to the left carries the value of (1, 2, 4, 8, 16 so the number multiplied by two and so on) with that you’ll see how 10 is two and 100 is four. As for the last one Jason explained how that works. In programming 1 is true and 0 is false. If something is true + true it’s always true. Anything else (false + false or true + false) is always false.
Comments