Suppose the value of the boolean variable b is false and the value of the int va
ID: 3861601 • Letter: S
Question
Suppose the value of the boolean variable b is false and the value of the int variable x is 0. What is the value of each of the following expressions? a. b && x = = 0 b. b || x = = 0 C. !b && x = = 0 d. !b || x == 0 e. b && x ! = 0 f. b || x != 0 g. !b && x ! = 0 h. !b || x ! = 0 Simplify the following expressions. Assume b is a variable of type boolean. a. b = = true b. b == false C. b ! = true d. b ! = false Simplify the following statements. Here, b is a variable of type boolean and n is a variable of type int. a. if (n = = 0) {b = true;} else {b = false;} b. if (n == 0) {b = false;} else {b = true;} C. b = false; if (n > 1) {if (nExplanation / Answer
14)
here && - logical and
|| - logical or
a)answer : False
explantaion:
b = false
x==0 .. true
false && true is false
b)answer : True
explanation:
b = false
x==0 .. true
false || true is true
c)answer: True
b = false
!b is true
x==0 .. true
true && true is true
d)answer : True
b = false
!b is true
x==0 .. true
true || true is true
e)answer:False
b=false
x!=0 is false
false && false is false
f)answer: false
b=false
x!=0 is false
false || false is false
g)answer: False
b=false
!b is true
x!=0 is false
true && false is false
h)Answer : True
b=false
!b is true
x!=0 is false
true || false is true
15)
let b = false
a)answer : false
explanation:false==true..is false
b)answer : true
explanation : false==false.. is true
c)answer: true
explanation :false !=true.. is true
d)answer: false
expanation : false !=false is false
16)
let n = 0
a) n== 0 is true..so b=true
b) n==0 is true .. so, b=false
c)n>1 is false , since n is 0
so b =false
d)n<1 is true, so.. b=true
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.