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
Discussion:
23 comments Page 1 of 3.
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.
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)
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.
Apart from this, if the first condition becomes true then compiler go for checking the second condition.
(1)
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.
3>6 i.e. FALSE.
7>4 i.e TRUE.
True&&False=False.
Hence, the answer is false.
(1)
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.
3 > 6 && 7 > 4
3 > 76 false then no need of evaluate 7 > 4.
Ashwini said:
1 year ago
Agree, False is the right answer.
Lokesh said:
3 years ago
False is the right answer.
Bilal munniwale said:
8 years ago
Whats the use of && operator here?
Vrushabh said:
9 years ago
3>6 is false and we used && operator which gives the combined result as false.
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.
Michael samonte said:
1 decade ago
&& is a logical operator that is true only if both are true, otherwise, it is false.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers