CS560 Final Exam: May 9, 2006 - Answers & Grading Guide

James S. Plank

Answer All Questions - Note the point differential between questions, and make sure to allocate your time accordingly.


Question 1: 5 points

Once again, Freddy has missed the boat a bit. Granted, he is testing for quite a few important things. However, the compiler can still have a Trojan Horse in it: It can stuff its own code into the executable files that it creates, and that code can do anything.

Grading

If you mentioned the Trojan Horse, you got all five points. I did give partial credit to some other answers:

Question 2: 16 points

Grading

I tried to be lenient, and if you made an incorrect assumption that affected multiple parts, I tried not to let it harm you multiplicatively.

Question 3: 11 points


Question 4: 6 points

Looks like I asked this in 2005 as well. Should have been really easy for you. To quote: "A file allocation table is a way of implementing a linked index scheme for files that has a number of advantages over storing a link at the end of each block of a file. Specifically, the blocks on a disk are partitioned into data blocks and link blocks. The link blocks are in the first blocks of the disk, and are composed solely of links for the data blocks. The directory entry for the file is simply a pointer to the first block of the file.

"For example, the first link in the first link block contains the link for the first data block on the list. Thus, if a file is composed of multiple blocks, the link for the file's first data block points to the second data block, and so on. Obviously, the last block's link will contain a NULL pointer.

"This scheme is preferable to storing links in the data blocks for two main reasons. First, the block's size can be a power of two, which is often very convenient. In other words, the block itself is not broken up into a data portion and a metadata portion. Second, the link blocks themselves may be cached in the operating system, and therefore finding the bytes in the middle of a file does not require reading all of the previous data blocks from disk. Instead, the cached links may be used without any extra reading of data from disk.

"The links also provide a nice way to identify free blocks -- instead of having a NULL pointer or a pointer to another block, the link can have a different sentinel value that flags it as a free block.

"There are two kinds of caching in this system. The first is caching the link blocks, as discussed above. The second is performing standard disk block caching -- either LRU caching for frequently used blocks, or lookahead caching to optimize the performance of serial file access."

Grading