Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 1 (Q.No. 7)
7.
Evaluate the following expression: 3 >6&&7>4
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
23 comments Page 1 of 3.

Shariq said:   1 decade ago
First condition evaluated is 3>6 which is not true, condition is not checked further.

After which, if it was written 3<6, which is true then only second condition is tested for its trueness or false,

Let us consider condition before && evaluated true.

2 cases arise if the next condition is true or not.

Accordingly then, use of && operator states if any one of i/p is false then result is false.

Amarjeet Singh said:   7 years ago
Here the condition 3>6 && 7>4 becomes false but in this, the compiler only checks first condition 3>6 because in the case of logical and (&&) operator if the first condition becomes false then there is no need of checking the second condition.

Apart from this, if the first condition becomes true then compiler go for checking the second condition.
(1)

Sumit said:   1 decade ago
In the expression the priority of various operator is as follow && (AND) than || (OR) than ! (NOT).

So here we have only and operator which means the expression is only true when both the condition is true.

Here 2nd condition is true but the first condition is false.

So expression is false.

Sourabh said:   10 years ago
In these expression we compare two condition if both of the condition returns true then the it returns truth value. Here && operand is a is a Logical AND, it checks both the given Condition.

3>6 i.e. FALSE.

7>4 i.e TRUE.

True&&False=False.

Hence, the answer is false.
(1)

Dhiraj said:   6 months ago
3 > 6 && 7 > 4

Evaluates as follows:
3 > 6 → false (0) because 3 is not greater than 6.
7 > 4 → true (1) because 7 is greater than 4.
False && true → false (0) because the && (logical AND) operator returns true only if both conditions are true.
(1)

Amit Kumar said:   10 years ago
Because of in general way if we will look then here is the used operator is AND and In && operator if both the conditions are true then only the output or result would be true otherwise result would be false. As 3 is not greater than 6 hence the answer is false for this.

Geetha said:   1 decade ago
&& (comparision between two oprands) in the above two conditions are false so the ans is false.

&&: It check two conditions true the result is true otherwise false. If one condition is true other condition is false then again the ans is false.

Tharun said:   1 decade ago
Hear the internal concept is logical operator (&&).

And according to the bit-wise operator (AND '^') we use and hear 3>6 is false we consider it is 0 and 7>4 is true we consider it is 1.

According to the truth table 0^1 is 0. It means false.

Pawan said:   1 decade ago
In && Operator if the (left side of && )first Condition False then compiler don't check the Condition(right side of &&) after the && operator.

3 > 6 && 7 > 4

3 > 76 false then no need of evaluate 7 > 4.

AZLAN Tanveer said:   1 decade ago
&& operator is comes under logical operator, if all operands i.e. conditions are true it evaluates to true and if any one or more than one or all of them are wrong it will evaluate to false.

It is necessary that all conditions should be true.


Post your comments here:

Your comments will be displayed after verification.