                          Computer Science 101
                               Quiz M     Name ______________________

For each of the following tasks identify the I/O mechanism that should be
used to accomplish it -- if multiple approaches work circle them all.


1. Read a single whitespace delimited "word" into a character array

   a. fgets()                       b. fscanf() with %s format

   c. fscanf() with %c format       d. fread()


2. Read a single character with no data conversion.

   a. fgets()                       b. fscanf() with %s format

   c. fscanf() with %c format       d. fgetc()


3. Read all the characters until a newline is found into a character array

   a. fgets()                       b. fscanf() with %s format

   c. fscanf() with %c format       d. fread()


4.  In this program the 3 declarations of y will
    int y = 52;
    int main()
    {
       int y = 34;                    a. will result in there being
       {                                 three separate locations
           int y = 77;                   in which a variable named
           printf("%d ", y);             y is stored.
       }
       printf("%d \n", y);
    }

    b. cause a syntax error for       c.  will result in all three
       duplication of declaration         declarations referring to
                                          the same memory location.
5. The output of the program will be:

    a. no output at all                b. 77 77

    c. 77 52                            d. 77 34



