1. ) If x = 4, y = 3, and z = 2, determine whether each expression below is true
ID: 3750334 • Letter: 1
Question
1. ) If x = 4, y = 3, and z = 2, determine whether each expression below is true, false, or invalid.
Problem
Expression
True, false, or invalid?
1
if (x)
2
if (x = 4)
3
if (x = = 4)
4
if ((z = 4) > x)
5
if (2 < x < 3)
6
if(‘k > ‘K’)
7
if(‘J’ = = 74)
8
if(“engine” < “engineer”)
9
if(x % 2 == 0)
10
if(x % 2)
11
if(x < 2 && x < -1 || x < 10)
12
if(x < 2 && (x < -1 || x < 10))
Problem
Expression
True, false, or invalid?
1
if (x)
2
if (x = 4)
3
if (x = = 4)
4
if ((z = 4) > x)
5
if (2 < x < 3)
6
if(‘k > ‘K’)
7
if(‘J’ = = 74)
8
if(“engine” < “engineer”)
9
if(x % 2 == 0)
10
if(x % 2)
11
if(x < 2 && x < -1 || x < 10)
12
if(x < 2 && (x < -1 || x < 10))
Explanation / Answer
Problem
Expression
True, false, or invalid?
1
if (x)
2
if (x = 4)
3
if (x = = 4)
4
if ((z = 4) > x)
5
if (2 < x < 3)
6
if(‘k > ‘K’)
7
if(‘J’ = = 74)
8
if(“engine” < “engineer”)
9
if(x % 2 == 0)
10
if(x % 2)
11
if(x < 2 && x < -1 || x < 10)
12
if(x < 2 && (x < -1 || x < 10))
false(&& ouside bracket , so both sides of && should be true which is not true here)
Do ask if any doubt. Please upvote.
Problem
Expression
True, false, or invalid?
1
if (x)
true ( x = 4 not equal to 0)2
if (x = 4)
invalid (comparison operator is ==)3
if (x = = 4)
true4
if ((z = 4) > x)
false(x = 4, so z is not > 4)5
if (2 < x < 3)
true ( 2<x = 1(true) and 1<3 is true)6
if(‘k > ‘K’)
true(ascii value of k is greater than K)7
if(‘J’ = = 74)
true(ascii value of J = 74)8
if(“engine” < “engineer”)
true9
if(x % 2 == 0)
true(4 is divisible by 2)10
if(x % 2)
false(remainder is 0)11
if(x < 2 && x < -1 || x < 10)
true(|| x< 10 is true)12
if(x < 2 && (x < -1 || x < 10))
false(&& ouside bracket , so both sides of && should be true which is not true here)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.