Full Transcript

CSE 1320: Introduction to Computers & Programming University of Texas at Arlington Fall 2024 Alex Dillho Exam 1 Review Topics 1. ASCII ˆ Understand the relationship between uppercase and lowercase characters. 2. Base Conversions ˆ Understand conversio...

CSE 1320: Introduction to Computers & Programming University of Texas at Arlington Fall 2024 Alex Dillho Exam 1 Review Topics 1. ASCII ˆ Understand the relationship between uppercase and lowercase characters. 2. Base Conversions ˆ Understand conversion from decimal to binary. ˆ Know the general procedure for converting between bases. 3. UNIX ˆ cd - Change directory. ˆ ls - List current directory contents. ˆ mv - Move a le. ˆ mkdir - Make a directory. ˆ rm - Remove a le. ˆ cp - Copy a le. 4. Formatting Standards ˆ Statements should be indented to reect their scope. ˆ Spacing should be consistent. ˆ Bracket and bracing placement should be consistent. 5. Identiers, Keywords & Reserved Words ˆ Know common keywords covered in class and assignments. ˆ Understand the rules for identier names. 6. Formatting Input & Output ˆ Apply eld width with to format specier (%10d). ˆ Truncate oating point precision (%.2f). ˆ Escape sequences (\t, \", \', \n, \\). 7. Operators ˆ Arithmetic Operators CSE 1320: Exam 1 Review Dillho ˆ Equality and Relational Operators ˆ Compound Assignment ˆ Increment and decrement ˆ Logical Operators ˆ Bitwise Operators 8. Preprocessor Directives ˆ #include ˆ #define 9. Control Structures ˆ if ˆ if-else ˆ switch ˆ while ˆ do...while ˆ for ˆ nested loops ˆ break ˆ continue ˆ return 10. Function Denitions vs. Declarations ˆ Be able to write the declaration of a given function. 11. Arrays and Strings ˆ Know how to declare and initialize 1D arrays. ˆ Know how to declare and initialize 2D arrays. 12. File I/O (a) Outcomes ˆ Open a le for reading, writing, appending, and update. ˆ Closing a le. ˆ Understand that the FILE * object has a pointer to the current position in the le and reading moves that pointer forward. ˆ Know how to check if a le was opened correctly. ˆ Write your own code to check that a le exists. (b) Problems ˆ Open a text le, read the information, and copy the words in reverse order to a new le. 2 CSE 1320: Exam 1 Review Dillho ˆ Open a text le, read the information, and write it to a new le in order from lines with the most words to the least. ˆ Create a program which checks a CSV le to ensure that there are no issues with the data. For example, if one of the lines is missing a property then it would be agged as invalid. ˆ Create a CSV le which stores information about student grades. Open the le in a program and print each line in a neatly formatted table. You can decide which information is appropriate. 13. Structures (a) Outcomes ˆ Be able to declare structures and variables to structures. This includes include declarations of variables with the structure declaration. ˆ Understand how initialization works with structure variables. ˆ Understand what is meant by packing and padding in relation to struc- tures. ˆ Understand how structures and their sizes dier from other aggregate types. For example, the size of a struct can always be inferred where as a pointer to an array does not carry that information. (b) Problems ˆ Create a function which takes a pointer to struct as an argument. Com- pare the size of the pointer to the dereferenced struct. ˆ Create including one for car and manufacturer in which every car has as a member the manufacturer for which it belongs. ˆ Create a has a FILE * as a member along with another member to keep track of the total number of bytes read by the le. Implement this in a program which updates this byte count every time a call to fgetc() or fread() is made. 14. Typedefs (a) Outcomes ˆ Familiarity with typedef syntax. ˆ Create a typedef with aggregate types (including struct). (b) Problems ˆ Create a 4D vector using typedef. ˆ Create a struct that is dened using typedef. Question Types & Examples Denition & Evaluation These questions will test your knowledge of basic terms and concepts in C. At most they would require a statement or two, in your own words, about the concept being asked. 3 CSE 1320: Exam 1 Review Dillho Examples ˆ Given a function declaration, how would you write the equivalent denition? You do not need to write the code inside the function itself. // Declaration int is_odd(int); // Definition int is_odd(int number) { // This can be left empty. } ˆ What type of value does the expression below return? int a = 5; (a = 10); //

Use Quizgecko on...
Browser
Browser