This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS107 Handout #8 J Zelenski Nov 30, 2009 Final practice Final Exam: Friday, Dec 11th 8:30-11:30am (bright and early!) Gates B01 and Gates B12 This is our official registrar-scheduled exam time. There is no alternate exam. No electronic devices are allowed, but you may bring your textbook, notes, code printouts, etc. As we encouraged for the midterm, don't let "open book" lull you into believing you don't need to prepare. Go back through the topics and practice problems on paper until you are ready to work efficiently and without error on the real exam! Material The final is comprehensive but expect more coverage on post-midterm topics and particular focus on material covered in the labs and assignments. Take a peek in your rear-view mirror and check out the impressive list of things you've learned in 107: C strings, arrays, pointers, & , * , void* , typecasts, function pointers Data representationbits, bytes, ASCII, two's complement integers, floating point, layout of arrays and structs, pointers IA32 assembly basic instruction set, data access and addressing modes, arithmetic and logical ops, implementation of C control structures, function call/return, register use Address spacelayout and purpose of text/data/stack/heap segments, handling of globals /locals/parameters Runtime stack protocol for function call/return, parameter passing, management of ebp and esp registers Compilation tasks handled by preprocessor, compiler, assembler, and linker, static and dynamic linking, object files and executables, makefiles Memory memory hierarchy, caches, locality, static versus dynamic allocation, heap allocator strategies and tradeoffs Performance compiler optimizations, measuring execution time, profiling Concurrency threads, race conditions, and mutual exclusion (no in-depth questions on these topics) Python simple Python scripting, Python as antithesis of C: interpreted versus compiled, dynamic versus static type system, safety versus efficiency, etc. (no in-depth questions on these topics) The rest of this handout is the exact final I gave last spring in CS107 so questions are fairly representative in terms of format, difficulty, and content. To conserve paper, I cut back on answer space. The real exam will have much more room for your answers and scratch work. We'll distribute solutions to all problems in the next lecture. Good luck preparing! 2 Problem 1: C coding An ELF file uses a stringtable ("strtab") section to compactly store a set of strings. A stringtable consists of a sequence of null-terminated strings laid out contiguously. An individual string is accessed by its offset. Here is an example stringtable: r e d \0 b l u e \0 y e l l o w \0 g r e e n \0 Note that strings with same suffix can share characters. In the stringtable above, the string "yellow" is found at offset 9 and the string "low" is found at offset 12....
View Full Document