In the following snippet in a typical C-like language, how many times does the loop body actually execute given that the loop variable is also incremented inside the body?nfor (int i = 0; i u003C 5; i++) {n i += 1;n}nAssume standard integer arithmetic and that the loop increment i++ occurs after each iteration.
Consider the loop below using IEEE-754 binary double precision without special rounding exceptions:nfor (double x = 0.0; x != 1.0; x += 0.1) { /* work */ }nWhich statement best describes its termination behavior?
You want to refactor the post-test loop do { body } while (cond); into a pre-test loop in a generic C-like language; assuming body has no break or continue and cond has no side effects, which re-write is behaviorally equivalent even when cond is initially false?
Given the code below in a C-like language, what is the final value of s?nint i = 0, s = 0;ndo {n i++;n if (i % 2 == 0) continue;n s += i;n} while (i u003C 5);
Given the code below in a C-like language where, in a for loop, the update expression runs after the body even when continue is used, what are the final values of a and b?nint a = 0, b = 0;nfor (int i = 0; i u003C 3; i++) {n a += i;n if (i % 2 == 0) continue;n b += i;n}nReport the pair as a,b.