To be precise, we have two types of situation here:
1. If (X and Y)
2. (P and Q) ==
In the first situation we have to check whether both X and Y is true or not. If both are true then the code will execute and if both are false then the code will not get executed.
But in the second situation we are marking the values of P and Q to be exactly something.
The key difference between situation 1 and 2 is that in 1 we have ‘if’ and in 2 we have ‘==’.
And in ‘if’ we want conditions to be true but in ‘==’ we want conditions to be exact of some value.
So, regarding the question in Mock Test we have
In place of X: “(A and B) == False”
In place of Y: “(A or B) == True”
In place of P: A
In place of Q: B
Just tell me if I am right or wrong. If I am wrong what are those points.If it is given that “A = True and B = False” what is the difference between:
1. If (A and B == False)
2. A and B == False
3. If (A and B)
Hi,
I apologize for chiming in without reading the entire discussion thread:I answered correctly for Q7 and this is how I interpreted the following psuedo-code block:
My interpretation:
1. (A and B) == False means : if the 2 conditions "A is TRUE" AND "B is True" - Both conditions- turn out to be FALSE. This can happen iff either A is true OR B is true, but NOT while both A and B is TRUE (at the same time). 'Çause in that case (A and B) then would be == TRUE. Right?
2. (A OR B) == True means : if either the condition "A is TRUE" OR the condition "B is True" - any one turns out to be TRUE.
3. So this checks out what is asked in the question (exclusive OR condition) - if either is true but not BOTH, type of a scenario.
Best.