File: hw11.txt Your name: Did you work with or get help from anyone? Due Thursday, March 21 by 11:59pm. Points: 15 points total. Extra credit: none. Copy this file to your handin directory and complete the following... (1) 3 points. Given integer variables x, y, and z, give Boolean expressions to test each of the following. Example: If all three are the same. Correct answer: (x == y) && (y == z) Not-as-correct answer: x = y = z, or x == y == z Okay: (x = y) AND (y = z) 1a. If they are in increasing order. (x <= y) && (y <= z) x < y and y < z 1b. If they are in decreasing order. (x > y) && (y > z) 1c. If they are three different values. (x != y) && (y != z) && (x != z) (2) 4 points. Given a character string s that was declared and set like char s[100]; printf("Type something... "); scanf("%s", s); give Boolean expressions to test each of the following. 2a. If the first letter they typed was 'o'. Note: remember that the first letter they typed would be s[0]. s[0] == 'o' strncmp(s,"o",1)==0 2b. If the first two letters they typed were 'o' and 'k'. (s[0] == 'o' && s[1] == 'k') strncmp(s,"ok",2) == 0 2c. If they typed "ok" exactly (including case, and not longer than ok). (s[0] == 'o' && s[1] == 'k' && s[2] == '\0') (s[0] == 'o' && s[1] == 'k' && strlen(s) == 2) strcmp(s,"ok") == 0 (3) 4 points. Given a char variable ch, give formulas for each of the following. 3a. Determine which letter ch is in the alphabet. If ch is 'a', your formula should be 0, if ch is 'b' it should be 1, etc. Note: remember you can view ch as its integer value from the ASCII table. ch-'a', where thinking of ch and 'a' as the ASCII values. 3b. A Boolean expression to test if ch is lower case. Note: what are the ASCII values for lower case letters. View ch as an integer, and ... (ch >= 'a' && ch <= 'z') 3c. Assuming ch is a lower case letter, convert it to an upper case letter. ch-'a'+'A' (4) 4 points. Given this list of numbers: 6, 2, 5, 1, 7, 8, 0, 3. Recall the algorithm we talked about in class for sorting that list of number, which is also reviewed in the notes.txt (search in notes.txt for "Sorting an array"). Since there are 8 numbers in the list, the algorithm will end up doing potentially 7 different swaps of numbers before the list is sorted. The first step is to find the smallest and switch it to the front of the list. That would give you 0, 2, 5, 1, 7, 8, 6, 3. The next step would be to find the next smallest and switch it to the second spot in the array, giving you 0, 1, 5, 2, 7, 8, 6, 3. I just showed what the array looks like for the first two steps. Now, you show what it looks like for the remaining 5 steps of the algorithm. 0, 1, 2, 5, 7, 8, 6, 3. 0, 1, 2, 3, 7, 8, 6, 5. etc. (5) 0 points. Come up with an exam question (or questions). Type in what the question is (and what the answer is, if you want). For ones that are pretty good, I may collect them and post them for people to practice on.