** On paper portion. Points: 20 points total, 10 points for #1, 10 points for #2 Last Name: First Name: Section (start time of your class): 1) Run the algorithm. Use the indicated algorithm to answer each question. Show your work. No credit if you don't show your work. 1a) Use selection sort to sort the numbers -1, 2, 4, 0, -2, 3, 1 -1, 2, 4, 0, -2, 3, 1 -2, 2, 4, 0, -1, 3, 1 -2, -1, 4, 0, 2, 3, 1 -2, -1, 0, 4, 2, 3, 1 -2, -1, 0, 1, 2, 3, 4 1b) Encrypt the message "farewell all" using the caesar cipher and password 5. abcdefghijklmnopqrstuvwxyz farewell all kfwjbjqq fqq 1c) Convert the hexadecimal number D2 to decimal. 0123456789ABCDEF 012345 D2 = 16*D + 1*2 = 16*13 + 2 = 210 D2 = 1101 0010 = 128 + 64 + 16 + 2 = 210 1d) Determine if the number 79 is prime. sqrt(79) = 8.something 79/2 = 39, R 1 79/3 = 26, R 1 79/4 = 19, R 3 79/5 = 15, R 4 79/6 = 13, R 1 79/7 = 11, R 2 79/8 = 9, R 7 79 is prime 2) Be the computer. For each, keep track of the values of all the variables as the code runs - as we did in class. 2a) loops. // code int x=2, i=0, total=0; while (x != 0) { i++; total += x; if (x % 2 == 0) x = x / 2; else x = 2*(x - 1); if (i >= 10) break; } // variable values. // // i: 1, 2, 3 // // x: 2, 1, 0 // // total: 0, 2, 3 // 2b) functions. // code int f1(int x, int y) { int temp = x; x = y; y = temp; return f2(x,y); } int f2(int z, int w) { int temp = w; w = z; z = temp; return w; } int main() { int x=1, y=2, z=3; x = f1(y, z); y = f2(x, z); } // variable values. // // x in main: 1, 3 // // y in main: 2, 3 // // z in main: 3 // // temp in f1: 2 // // x in f1: 2, 3 // // y in f1: 3, 2 // // temp in f2: 2; 3 // // z in f2: 3, 2; 3 // // w in f2; 2, 3 (returned); 3 2c) arrays. // code char msg[10] = "hello"; int i; for(i=0; i<5; i++) { msg[i] = msg[i] + 1; } for(i=0; i<4; i++) { msg[i] = msg[i+1]; } // variable values. // // i: 0, 1, 2, 3, 4, 5; 0, 1, 2, 3, 4 // // msg: "hello", "ifmmp" // "iello", "ffmmp" // "ifllo", "fmmmp" " "ifmlo", "fmmmp" // "ifmmo", "fmmpp" // "ifmmp" //