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. (You may abbreviate them as A, N, or S.)
public static int funky(int a, int digit) {
int count = 0;
// Point A
while (a != 0) {
// Point B
if (a % 10 == digit) {
count++;
// Point C
} else if (count > 0) {
count--;
// Point D
}
a = a / 10;
}
// Point E
return count;
}
a=0 a =10== digit  count >0 Point A  Point B  Point C  Point D  Point E \begin{array}{l|l|l|l} & a=0 & \text { a }=10==\text { digit } & \text { count }>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