                          Computer Science 101
                               Quiz I      Name ______________________

1. What will be the value of y after the following code is executed:
   y = 4;
   p = &y;
   *p = 7;

   a. 4                                  b. 7

   c. the address of y                   d. Undefined

2. Which best characterizes the behavior of the following program:
   main()
   {
      int *p;
      *p = 99;
      printf("The value of p is %d \n", *p);
   }

   a. The program is correct and        b. The program is incorrect
      should be expected to work           and will fail in all environments
      fine in all environments             before the printf() is executed

   c. The program is incorrect, but
      it may appear to work correctly
      in some environments.

3. Suppose the following declarations are made in a program to be
   run on an Intel x86 computer.

   char  *x;
   short *y
   long  *z;

   a. Each of the three pointer      b. The three pointer variables consume
      variables consumes 4 bytes        1, 2, and 4 bytes respectively
      of space.

   c. Each of the three pointer
      variables consumes 1 byte
      of space.

 4. Given the following declarations
    int x;
    int *p;

   Identify the assignments that are syntactically correct and will
   compile without warning or error.

   ___ a.  p = x;

   ___ b.  p = &x;

   ___ c.  *p = 15;

   ___ d. x = *p;
