Consider two functions in a language with short-circuiting (operator precedence: u0026u0026 before ||, evaluated left-to-right): T() increments countT and returns true, and F() increments countF and returns false. Starting with countT = 0 and countF = 0, what is the outcome of evaluating the chain: if (F() u0026u0026 T()) { branch1 } else if (T() || F()) { branch2 } else { branch3 }?
In the following brace-less pseudo-code, assume each else binds to the nearest unmatched if: if (x u003E 0) if (y u003E 0) sign = 'Q1'; else sign = 'Non-positive x'; With x = 5 and y = -2, what is the final value of sign after this sequential conditional execution?
Consider this iterative minimum-finding routine over array A[0..n-1]: min = A[0]; for (i = 1; i u003C n; i++) { if (A[i] u003C min) min = A[i]; } Which statement is the strongest correct loop invariant that holds at the start of each iteration for index i?
In a language with do-while semantics (the loop body executes at least once), consider the sequential code: x = 10; count = 0; do { x = x * x - 1; count = count + 1; } while (x u003C 10); After the loop terminates, what are the final values of x and count?
Given this iterative control flow with both continue and break, where % denotes remainder: sum = 0; for (i = 1; i u003C= 5; i++) { if (i % 2 == 0) continue; sum = sum + i; if (sum u003E 5) break; } After the loop finishes, what are the final values of sum and i?