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.)
Correct Answer:
Verified
Q1: If/Else Simulation
For each call below to
Q2: Programming
Write a static method named randomRects
Q3: Programming
Write a static method named graduation
Q4: Parameter Mystery
At the bottom of the page,
Q5: While Loop Simulation
For each call below
Q7: Expressions
For each expression in the left-hand
Q8: Programming
Write a static method named cheerleader that
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents