Guided Exploration 03: Explore Chapters 03 and 04 Concepts Purpose: Explore control structures, how C reads input in from stdin (keyboard), and secure programming. Effort: Collaborate (Academic Integrity) Do not
use Al tools such as ChatGTP for this exploration. You should start this assignment before you connect with others to discuss. Points: 20 (See Rubric in Canvas) Deliverables: Upload this document with your answers and your Technical Documentation. If you collaborated with others include name(s): Do not wait until the day before this is due to start. If you are not understanding some of the concepts please look at my office hours so I can support you earlier rather than later. Part 1: Review Lectures and Read Following Book Sections You can include in your resume that you incorporated practices from the SEI CERT C Coding Standard This means if they ask you about this in your resume you can give some examples. Just review your document before the interview. Review lectures and book sections Secure C programming at the end of each chapter we have covered so far. Update your technical documentation to include the secure programming guidelines- this should include examples and why it is necessary. These will be expected to be incorporated in your code submissions. Highlight your technical documentation in yellow where you included this information. Book Sec 4.6 Reading Character Input and EOF Put the link to the standard library resource for the getchar function. How do you enter EOF on your operating system? Part 2: Understanding Control Structures Show the precise output that will occur following the execution of the following code segments without running the code. Then run the code to see if your output was correct. This is the type of question that might be on an exam to be able to give the output of the program. Exercise 3.12 in the book Output LSGA W NH 2 6 ∞OHNM 8 10 11 12 13 14 #include int main (void) { int x = 1; int total = while (x <= 10) { int y = x * X; printf("%d\n", y); total += y; ++x; } // end while total); 15 } // end main 0; printf ("Total is %d\n", Part 3: Explore Reading Input 3.1 Explore Code fig4_05 (in repos and in book sec 4.6) 1. Open ASCII coding scheme and open fig4_05 from Github class code in your editor. Set breakpoint at start of while loop and debug. a. Enter 2 and step through the code. Answer the following Put a screenshot of what is stored in grade. What case statement is executed? How many times does the while loop execute after entering 2? Put a screenshot of what is stored in grade. What case statement is executed? Explain what you think is happening. Explain what happens. b. Enter character 'a' and step through the code c. Enter the EOF character and step through the code Explain what happens 2. Secure Programming Practices List examples from the code where secure programming practices were implemented and explain them. 3. Reading in characters using getchar Explain this code ((grade = getchar()) != EOF) 4. Initializing Put the initialized variable below. Explain why it is important to initialize variables in C. 5. Commit version on your machine and push to github Put screenshot of the versioned code in your github repository Part 4: Validation Read section 3.8 - 3.10. Open the program in Figure 3.6 in your class code repository. Modify the program so that on any input, if the value entered is other than 1 or 2, keep looping until the user enters a correct value. This means if a non numeric value is entered the program should handle that situation. What lecture and slides give information on how to approach validating numeric input from a user? Summarize the steps below What test cases did you try to see if your updates worked? What test cases still do not work? Copy and paste your updated code. Part 5: Algorithms Read Chapter 1 from Hannah Fry, "Hello World, Being Human in the Age of Algorithms: p. 1-24 Answer the following in your own words based on the reading. An algorithm in computer science is? What is one pro and one con for rule-based algorithms? Summarize each algorithm category in one sentence. Prioritization: ● Filtering: Association: Classification Share something you found interesting in this reading Part 6: Pseudocode and Algorithms Develop an algorithm in pseudocode by writing on paper, on a whiteboard or on a table for verifying a user enters a correct id and passcode within so many attempts. Assume that the user enters a valid integer. Do not type your pseudocode or it will not be counted. Prompt for id: "Enter your UCCS id." Prompt for id: "Enter your UCCS pass code." Check if id and passcode are correct If the id is incorrect, display "Error: UCCS id incorrect." If the passcode is incorrect, display "Error: UCCS passcode is incorrect." After three incorrect attempts display "Exiting UCCS" If the correct id and passcode is entered within 3 attempts display "Logged in" For example, what if the correct id is 7777 and the correct passcode is 1234 and they have 3 attempts. Enter the possible test cases: inputs and outputs that can happen. Some have been completed. Fill in the remaining parts of the table. Input Repeated 3 times Incorrect Id = 12 Incorrect Passcode = 444 Repeated 3 times Correct Id = 7777 Incorrect Passcode = 6789 Repeated 2 times Output Repeated 3 times "Error: UCCS id is incorrect." "Error: UCCS passcode is incorrect." Final message: "Exiting UCCS" Repeated 3 times "Error: UCCS passcode is incorrect." Final message: "Exiting UCCS" Repeated 3 times "Error: UCCS id is incorrect." Final message: "Exiting UCCS"