150k views
24 votes
PLEASE HELP ME! Consider the block of code below. When will the value of s be equal to 5? (Java Programming) (3 points)

if(isFemale)
s = 5;
else
s = −161;

a. isFemale equals 5
a. isFemale equals 'F'
c. isFemale equals "F"
d. isFemale equals true
e. isFemale equals −161

User Danbanica
by
4.2k points

1 Answer

6 votes

Answer:

d. isFemale equals true

Step-by-step explanation:

I believe that the answer would be d: isFemale equals true. I am an AP Computer Science Principles student this year, and when we code apps we use "if else" blocks, and if the "if" statement is true, then the code will follow through with the "if" section. If not, then it will follow through with the "esle" section.

Therefore, if (isFemale) is true, the code would follow that section, and have s=5.

I hope this helps! :)

User Xyzjayne
by
4.5k points