CSci351 Introduction to File Processing: Homework 1

Due date: Monday, February 11, 2008 in class
Each homework may have a different weight, which depends on its level of difficulty.
Absolutely no copying others' work


  1. Show how to change the permissions on a file myFile so the owner has read, write, and execute permissions, group members have read and execute permission, and others have execute permission.     (05%)

  2. Find what value is used to indicate end-of-file in the stdio.h/cstdio of C/C++.     (05%)

  3. Write a C/C++ program to create a file and store a string in it. Write another C/C++ program to open the file and read the last ten bytes of the string and put it into the variable myString.     (15%)

  4. Write a C/C++ program to implement the Unix command tail -n, where n is the number of lines from the end of the file to be copied to stdout.     (15%)

  5. The ABC 1234 disk drive has the following features: Suppose you have a file with 300,000 200-byte records that you want to store on a 1234 drive. Answer the following questions:
    1. How many blocks can be stored on one track? How many records?     (10%)

    2. How many cylinders are required to hold the file? How much space will go unused due to internal track fragmentation?     (10%)

    3. If the file were stored on contiguous cylinders and if there were no interference from other processing using the disk drive, the average seek time for a random access of the file would be about 10.0 msec and the time to read one track is 12.0 msec. Use this rate to compute the average time needed to access one record randomly.     (10%)


  6. Consider a mailing-list file with 1,500,000 100-byte records. The file is to be backed up on a tape drive which has the following features: Answer the following questions.
    1. How many extra records could be accommodated on a 4800-foot tape?     (10%)

    2. What is the nominal transmission rate?     (05%)

    3. How long would it take to read one block, including the gap? What would the effective transmission rate be? How long would it take to read the entire file?     (15%)