                          Computer Science 101
                               Quiz 5      Name ______________________

1. Suppose my program contains:

       n = fscanf(stdin, "%d %d %d", &x, &y, &z);

   and I enter the values:

    1234 56a7 9122

   What values will be assigned to n, x, y, and z?  If a variable will not
   be assigned a value just write "unchanged".

   n =                                x =

   y =                                z =

2. Identify the error(s) in the following program and write a correct version
   of any defective statement(s). The program's objective is to
   read a single integer from the standard input and write its
   value to the standard output.

   #include <stdio.h>
   int main()
   {
        int value;
        int num;

        num = fscanf(stdin,"d", value);
        fprintf(stdout,"d", value);
        return (0);
   }

4. What value will the following code print:

   int x = 5;
   int y = 7;
   int z = 10;

   if  ((x < 7) || (z < x))
      printf("%d", x);
   else
      printf("%d", y);


5. What value will the following code print:

   int x = 5;
   int y = 7;
   int z = 10;

   if  ((x < 7) && !(y < z))
      printf("%d", x);
   else
      printf("%d", y);



