Evaluate the truth values of the following conditions given the values of the de
ID: 3724477 • Letter: E
Question
Evaluate the truth values of the following conditions given the values of the declared variables. NOTE: Conditions formed using relational or equality operators (>, <, >=, <=, ==, !=) are relational conditions. Conditions formed using logical operators [&& (AND), || (OR), & (boolean AND), | (boolean inclusive OR), ^ (boolean exclusive OR) are complex conditions.
Variables
boolean goodEssay = false;
double gpa = 3.0;
boolean technicalDegree = true;
Conditions:Evaluate then indicate the truth value produced by the relational conditions and the joins. NOTE: Change in variable values do not carry over to next evaluation.
Truth Value of Complex Conditions
F (short-circuit)
goodEssay && technicalDegree || gpa > 3.0
FF
goodEssay && technicalDegree || gpa > 3.0
False
False
goodEssay && (technicalDegree == false) && (gpa >= 3.5)
!(technicalDegree && goodEssay)
goodEssay = true;
goodEssay & !(technicalDegree & (gpa != 3.0))
goodEssay ^ technicalDegree || (gpa == 5.0)
gpa = 3.5;
(goodEssay || technicalDegree) && (gpa > 3.25))
goodEssay & technicalDegree | (gpa == 4.0)
!goodEssay | (technicalDegree ^ (gpa >= 3.0))
Variables
int peopleInvited = 10;
double catering = 5000.00;
double facilityFee = 500.00;
Conditions:Evaluate then Indicate the truth value produced by the relational conditions and the joins. NOTE: Change in variable values do not carry over to next evaluation.
Truth Value of Complex Conditions
(facilityFee > 350.00) && (catering > 3000.00) | (++peopleInvited >= 10)
(peopleInvited > 10) || (catering >= 5000.00) && !(facilityFee < 500.00)
facilityFee = 1000.00
(peopleInvited >= 10) & (catering != 5000.00) || !(facilityFee < 1000.00)
Variables
boolean goodEssay = false;
double gpa = 3.0;
boolean technicalDegree = true;
Explanation / Answer
goodEssay && (technicalDegree == false) && (gpa >= 3.5)
explanation: goodEssay = false(0),technicalDegree = true(1), gpa = 3.0
0 && (1==0) && (3.0 >= 3.5) therefore, [1 == 0 is false(0)]
=> 0 && (0) && (3.0 >= 3.5) therefore, [3.0 >= 3.5 is false(0)]
=> 0 && (0) && (0)
=>0 (false)
False
!(technicalDegree && goodEssay)
Explanation :
!(1 && 0) therefore [1 && 0 is 0(false)]
=> !(0) therefore [!0(negation of 0) is 1(true)]
=> 1
True
goodEssay = true;
goodEssay & !(technicalDegree & (gpa != 3.0))
Explanation :
=> 1& !(1& (3.0 != 3.0))
=> 1& !(1& (false))
=> 1& !(1& (0))
=> 1& !(0)
=> 1& 1
=> 1
True
goodEssay ^ technicalDegree || (gpa == 5.0)
Explanation :
=> 0 ^ 1|| (3.0== 5.0)
=> 0 ^ 1|| (false)
=> 0 ^ 1|| (0)
=>1 || (0)
=>1
True
gpa = 3.5;
(goodEssay || technicalDegree) && (gpa > 3.25))
Explanation :
=>(0|| 1) && (3.5 > 3.25))
=>(0|| 1) && (true))
=>(0|| 1) && (1))
=>(0|| 1) && 1)
=>(1) && 1) [error : braces mismatch] if it is typo
=>1
True
goodEssay & technicalDegree | (gpa == 4.0)
Explantion :
=> 0& 1| (3.0== 4.0)
=> 0& 1| (false)
=> 0& 1| (0)
=>0| (0)
=>0
False
!goodEssay | (technicalDegree ^ (gpa >= 3.0))
Explanation :
=> !0 | (1 ^ (3.0 >= 3.0))
=> !0 | (1 ^ (true))
=> !0 | (1 ^ (1))
=> !0 | (1 ^ 1)
=> !0 | (0)
=> 1 | (0)
=> 1
True
Variables:
int peopleInvited = 10;
double catering = 5000.00;
double facilityFee = 500.00;
(facilityFee > 350.00) && (catering > 3000.00) | (++peopleInvited >= 10)
Explanation :
=> (500.00 > 350.00) && (5000.00 > 3000.00) | (++10 >= 10)
=> (500.00 > 350.00) && (5000.00 > 3000.00) | (11 >= 10)
=> (true) && (true) | (true)
=> (1) && (1) | (1)
=> 1
True
(peopleInvited > 10) || (catering >= 5000.00) && !(facilityFee < 500.00)
Explanation :
=> (10 > 10) || (5000.00 >= 5000.00) && !(500.00 < 500.00)
=> (false) || (true) && !(false)
=> (0) || (1) && !(0)
=> (0) || (1) && 1
=> 0 || 1 && 1
=> 1
True
facilityFee = 1000.00
(peopleInvited >= 10) & (catering != 5000.00) || !(facilityFee < 1000.00)
Explanation :
=> (10 >= 10) & (5000.00 != 5000.00) || !(1000.00 < 1000.00)
=> (true) & (false) || !(false)
=> (1) & (0) || !(0)
=> 1 & 0 || 1
=> 0 || 1
=> 1
True
goodEssay && (technicalDegree == false) && (gpa >= 3.5)
explanation: goodEssay = false(0),technicalDegree = true(1), gpa = 3.0
0 && (1==0) && (3.0 >= 3.5) therefore, [1 == 0 is false(0)]
=> 0 && (0) && (3.0 >= 3.5) therefore, [3.0 >= 3.5 is false(0)]
=> 0 && (0) && (0)
=>0 (false)
False
!(technicalDegree && goodEssay)
Explanation :
!(1 && 0) therefore [1 && 0 is 0(false)]
=> !(0) therefore [!0(negation of 0) is 1(true)]
=> 1
True
goodEssay = true;
goodEssay & !(technicalDegree & (gpa != 3.0))
Explanation :
=> 1& !(1& (3.0 != 3.0))
=> 1& !(1& (false))
=> 1& !(1& (0))
=> 1& !(0)
=> 1& 1
=> 1
True
goodEssay ^ technicalDegree || (gpa == 5.0)
Explanation :
=> 0 ^ 1|| (3.0== 5.0)
=> 0 ^ 1|| (false)
=> 0 ^ 1|| (0)
=>1 || (0)
=>1
True
gpa = 3.5;
(goodEssay || technicalDegree) && (gpa > 3.25))
Explanation :
=>(0|| 1) && (3.5 > 3.25))
=>(0|| 1) && (true))
=>(0|| 1) && (1))
=>(0|| 1) && 1)
=>(1) && 1) [error : braces mismatch] if it is typo
=>1
True
goodEssay & technicalDegree | (gpa == 4.0)
Explantion :
=> 0& 1| (3.0== 4.0)
=> 0& 1| (false)
=> 0& 1| (0)
=>0| (0)
=>0
False
!goodEssay | (technicalDegree ^ (gpa >= 3.0))
Explanation :
=> !0 | (1 ^ (3.0 >= 3.0))
=> !0 | (1 ^ (true))
=> !0 | (1 ^ (1))
=> !0 | (1 ^ 1)
=> !0 | (0)
=> 1 | (0)
=> 1
True
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.