Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Given two int variables, i and j, which have been decalred and initialized, a

ID: 3553242 • Letter: 1

Question

1. Given two int variables, i and j, which have been decalred and initialized, and two other int variables, itemp and jtemp, which have been declared, write some code that swaps the values in i and j by copying their values to itemp and jtemp respectively, and then copying itemp and jtemp to j and i respectively.

2. Given three already declared int variables, i,j, and temp, write some code that swaps the values in i and j. Use temp to hold the value of i and then assign j's value to i. The original value of i, which was saved in temp, can now be assigned to j.

3. Four integer variables, pos1, pos2, pos3, pos4 have been declared and initialized. Write the code necessary to "left rotate" their values: for each variable to get the value of the successive variable, with pos4 getting pos1's value.

4. Write an expression that evaluates to true if and only if the string variable s equals the string "end".

Explanation / Answer

1)