# Question

This is a discussion on Question within the C Programming forums, part of the General Programming Boards category; Q1.Which 1 will return a false value? a) true && true || false b) false || true c) (false || ...

1. ## Question

Q1.Which 1 will return a false value?

a) true && true || false
b) false || true
c) (false || true) && true
d) (false || true) || true

Q2.what is a post test loop?

a)do...while
b)while
c)both the for and the while
d} both the while and the do....while

2. OK, I've got my answers, now lets see yours.

3. Originally Posted by cpjust
OK, I've got my answers, now lets see yours.
i dont have the correct answer.. i choose Q1 B Q2a.. plz explain Q1 for me thx

4. Either you haven't written down the Q1 correctly, or the question itself is a trick question where NONE of the answers is right.

--
Mats

5. Originally Posted by matsp
Either you haven't written down the Q1 correctly, or the question itself is a trick question where NONE of the answers is right.

--
Mats
can u show me an example of return a false value?

6. false, !true, false && true, true && false, false || false, etc.

Sorry, but there are ENDLESS combinations of boolean logic that end with false.

The problem in the question posted is that either side of an || statement always have a true result, which means the end result will ALWAYS be true.

Code:
```true && true || false
false || true
(false || true) && true
(false || true) || true```
--
Mats

7. Originally Posted by matsp
false, !true, false && true, true && false, false || false, etc.

Sorry, but there are ENDLESS combinations of boolean logic that end with false.

The problem in the question posted is that either side of an || statement always have a true result, which means the end result will ALWAYS be true.

Code:
```true && true || false
false || true
(false || true) && true
(false || true) || true```
--
Mats
if this? (false || true) && false

8. yes, that will return false.

--
Mats

9. Originally Posted by matsp
yes, that will return false.

--
Mats
can u help me with swapping?printing backward thx

10. Originally Posted by archriku
Q1.Which 1 will return a false value?

a) true && true || false
b) false || true
c) (false || true) && true
d) (false || true) || true

Q2.what is a post test loop?

a)do...while
b)while
c)both the for and the while
d} both the while and the do....while
1.None. These are logical operators and return either true(1) or false(0) as their result. If both the operands of && are true then only && will return true, in all other case it will return false. For || if any one of the operators is true then the result will be true. For && if the first expression evaluates to false the second is not evaluated. For || if the first expression evaluates to true the second is not evaluated. The precedence of && is higher than ||.
2. do while is the only post test loop. This means that the body of the loop will be executed at least once.