Fall 2002 CSCI 333 Homework 5

This homework is not graded. It is practice for the 18 November quiz.

Problem 1

Consider an old-fashioned unzoned disk drive with the following characteristics.

The questions

Answer the following questions regarding the disk drive describe above.

  1. How many 512 byte sectors are on this disk drive?
  2. How many total tracks (on all cylinders) are on this disk drive?
  3. How many sectors are stored on each single track?
  4. How many sectors are stored on each cylinder?
  5. How long, in msec, does it take this disk to rotate?
  6. How many bytes can be read in one disk rotation?
  7. What is the average rotation delay in reading from the disk?
  8. What is the average time, in msec, required to read a random sector of data from the disk?
  9. If a 80Mbyte file could be stored in consecutive sectors of the disk, how many cylinders and tracks would it require?
  10. How long would it take to read this 80Mbyte file stored in consecutive sectors?

Problem 2

A file contains a sequence of integers, possibly separated by commas. Write a C++ subroutine which is passed an istream that has been opened to this file and returns the sum of all the integers in the file. Return -1 is the file is not in the correct format.

Here is an example of the file input:

   35  67, 89
13 5

13, 67

Here is a header for your function:

int SumEm(istream NumS)

Problem 3

Write some C++ statements to replace the fifth character of a file with the character 'X'.