Question: Identify the various assertions in the following code as being always true, never true, or sometimes true and sometimes false at various points in program
Identify the various assertions in the following code as being always true, never true, or sometimes true and sometimes false at various points in program execution. The comments indicate the points of interest:

Categorize each assertion at each point with ALWAYS, NEVER, or SOMETIMES.
public static int mystery (int n) { Random r = new Random (); int a = r.nextInt (3) + 1; int b = 2; // Point A while (n > b) { // Point B b = b + a; !! if (a > 1) { n--; // Point C a = r.nextInt (b) + 1; } else { a = b + 1; // Point D // Point E return n;
Step by Step Solution
3.48 Rating (165 Votes )
There are 3 Steps involved in it
Point A Sometimes true Sometimes false Never true Never true Point B Always true Sometimes true Some... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
2079_61d6ac344c76b_855305.pdf
180 KBs PDF File
2079_61d6ac344c76b_855305.docx
120 KBs Word File
