MC logo

Assignment and Side Effects II

  Practice Questions

  1. What are the values of j and k after the following code executes?
         int k = 3, j = 1;
         if (k = j++)
               k = 4;
    

  2. What is the value of m after the following code executes?
         int m = 6;
         m == 7;
    

  3. How many lines does the following print?
         int m;
         for(m = 3; m--; ) printf("Line.\n");
    

  4. Consider the following:
         int i = 1, m = 1, n = 2;
         i = --m || n++;
    
    What is the value of each variable after the code executes?

<<Assignment and Side Effects I Answer Control Constructs>>