Ask Question

Assume that count is 0, total is 20 and max is 1. The following statement will do which of the following? if (count! = 0 && total / count > max) max = total / count;

A) The condition will not compile because it uses improper syntax

B) The condition does not short circuit causing a division by zero error

C) The condition short circuits so that there is no division by zero error when evaluating the condition, but the assignment statement causes a division by zero error

D) The condition short circuits and the assignment statement is not executed

E) The condition short circuits and the assignment statement is executed without problem

+3
Answers (1)
  1. 4 August, 04:08
    0
    D) The condition short circuits and the assignment statement is not executed

    Explanation:

    count is 0.

    total is 20.

    max is 1.

    if (count! = 0 && total / count > max)

    max = total / count;

    If count is not zero AND total/count is bigger than max, max is updated.

    However, since count is 0, the program will not enter this loop, meaning that the condition will short circuit and the assignement will not be executed.

    The correct answer is:

    D) The condition short circuits and the assignment statement is not executed
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume that count is 0, total is 20 and max is 1. The following statement will do which of the following? if (count! = 0 && total / count > ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers