Solved

Assertions
for Each of the Five Points Labeled by Comments

Question 4

Essay

Assertions
For each of the five points labeled by comments, identify each of the assertions in the table below as either being always true, never true, or sometimes true / sometimes false.
public static int mystery(int a) {
int b = 0;
int c = 0;
// Point A
while (a != 0) {
// Point B
c = a % 10;
if (c % 2 == 0) {
b++;
} else {
b = 0;
// Point C
}
a = a / 10;
// Point D
}
// Point E
return b;
}
Fill in each box of the table below with one of the following words: ALWAYS, NEVER or SOMETIMES.
(You may abbreviate these choices as A, N, and S.)
 a !=0c%2=0 b>0 Point A  Point B  Point C  Point D  Point E \begin{array}{l|l|l|l} & \text { a } !=0 & c \% 2=0 & \mathrm{~b}>0 \\\hline \text { Point A } & & & \\\hline \text { Point B } & & & \\\hline \text { Point C } & & & \\\hline \text { Point D } & & & \\\hline \text { Point E } & & & \\\hline\end{array}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions