17.4k views
5 votes
Which answer choice is equivalent to the following decision?

if a > 12 then

  if b > 8 then

   output "Yes"

  endif

endif
a. if a > 12 OR b > 8 then output "Yes"
b. if a > b then output "Yes"
c. if a > 12 AND a > b then output "Yes"
d. if a > 12 AND b > 8 then output "Yes"

1 Answer

1 vote
D. if a > 12 AND b > 8 then output "Yes"
D is the only one that correctly combines those two logic gates. The and statement requires both conditions to be met just as the lengthy piece of code above does.
User Diana
by
7.5k points