Topics for Midterm Exam in COP 3402 $Date: 2024/09/27 02:08:56 $ This examination covers topics related to homework (project) assignment 1. REMINDERS This test will be for the second half of the period in class and will be closed book. However, you may use one (1) page of notes on one (1) side of a standard 8.5 by 11 inch sheet of paper. These notes can either be hand-written or printed, but if printed, then the font must be a 9-point or larger font. These notes must be turned in with the exam. READINGS See the recommended textbook (Systems Software by Montagne) chapters 1-3. See also the course lecture notes, which are available from the Files section of Webcourses in the folder named "Filled_in_Notes_from_Class_Sessions" (look at the file dates or the Outline-units.txt file for the ordering) or from the course resources webpage (https://www.cs.ucf.edu/~leavens/COP3402/resources.shtml#course). CONCEPTS/TOPICS Topics marked + below are more important than topics marked - below, which are less important (but were mentioned in the class). Topics marked ++ are very important. Topics marked -- are very unimportant. In general, conceptual questions, and questions that connect topics, techniques, examples, and ideas will be more important than details; the exam may be somewhat of a different flavor than the homework sets. I. Basic Terminology It's important to know and understand these terms, so that you understand the questions and can write sensible answers. A. Systems software + What is systems software? ++ What is a compiler? An interpreter? What is the difference? ++ What is an assembler? + What does a linker do? What does a loader do? ++ What does a compiler do (overall)? + What role does a VM play in systems software? + What is the format of the VM's BOF file (in general terms)? - What is an object file? 1. VMs and processors - What is an ISA? + When does the program counter get adjusted in a VM's cycle? ++ What does a jump instruction do in terms of how it affects the PC? -- What are the details (e.g., opcodes, function codes, etc.) for the SSM? - How can one tell if an ISA has enough instructions? + Why does an ISA need an EXIT (halt) instruction? + What happens if there is no EXIT instruction in a VM's program? - How would an if-then-else statement in a high-level language get translated into machine code (in terms of branch or jump instructions)? - How would a while loop be translated into machine instructions (in terms of what branch or jump instructions and needed)? - What is the memory hierarchy? Why is it important? 2. Assembly language - What are the advantages of assembly language over machine code? 3. Support for subroutines ++ Why are subroutines important? + What capabilities does a programming language need from a VM to support subroutines? ++ What features in a VM help support subroutines? + What is static scoping? Why is it useful? + What is the difference between a static property and a dynamic property (in general terms)? - What is block structure in a programming language? - What are the advantages of block structure? + Why should a language support recursion? - Why is it useful to have recursion to write a context-free parser? + What data structure in a VM or computer is necessary for supporting recursive procedures? ++ What is an AR? + What information is stored in an AR? + How is an AR (and the information stored in it) used to implement subroutine calls? + How does the VM use its registers in a subroutine call? B. Compilers ++ What are the main jobs of a compiler? + What are the main goals of a compiler? + What is done in the "front end" of a compiler? - What is done in the "middle end" of a compiler? + What is done in the "back end" of a compiler? + What are the advantages of a compiler over an interpreter? + What are the advantages of an interpreter over a compiler? - Can one combine a compiler and an interpreter? If so, how? 1. lexical analysis + What is a token? How are tokens used in a compiler? - What information is stored (or remembered) for each token? - What is a reserved word? What role do they play? - What is the difference between reserved words and key words? -- What are the advantages and disadvantages of using token objects over global variables holding the same information? - What is a regular expression? - How are regular expressions used in generating a lexer? + How are comments and whitespace handled in a lexical analyzer? 2. grammars and languages - How is a language defined using a grammar? + What is the relationship between a language and a grammar? + What kind of grammar is typically used for lexical analysis? Why? + What kind of grammar is typically used for parsing (syntax analysis)? Why? II. Skills When skill questions refer to a particular VM, the VM is likely to be the SSM of homework 1. When such a question refers to a programming language, the language will either be described in the question or it will be C. A. Modular C Programming + What is a module in the C programming language? ++ How are names kept private to modules in C? ++ Why not just write all the code for a program in one .c file? ++ Why is it useful to keep some names private in a module? ++ What kinds of information can a client obtain from a header (.h) file? ++ What kinds of information can be hidden in a .c file? ++ Why is it useful to include a module's .h file in its .c file? + How does Unix pass command line arguments and options to a C program? ++ Is the make program systems software? + How does a Makefile help build a C program with several modules? - What is a target in a Makefile? - What is a dependency in a Makefile? + When is a .c file recompiled into a .o file using make? - How does an IDE (e.g., Visual Studio) do the same tasks as the make program? B. SSM VM + How does the VM program check to see if it is called with the -p option? ++ What is the effect of the -p option on the SSM VM program's execution? ++ Why is a union useful for representing the memory of the VM in C? + How is the PC register represented in the VM in C? + How are registers represented in the VM in C? C. VMs + Write C code to interpret instructions for a VM + Explain what happens when a given program is run on a VM + Give the content of memory or registers after a VM executes an instruction or a program (starting from a particular state)