CS 1713 Introduction to Computer Science Daily Problem

Suppose we have the following:
   int x = 10;
   int y = 12;
   double z = 12;
   String s = "abcdefg";
   
Evaluate each of the following expressions:
  1. y/x;
  2. z/x;
  3. y/x + z/x;
  4. (y + z)/x;
  5. y % x;
  6. s.length();
  7. s.substring(2);
  8. s.substring(2,5);
  9. s.indexOf("BCD");

Solution:

  1. 1
  2. 1.2
  3. 2.2
  4. 2.4
  5. 2
  6. 7
  7. "cdefg"
  8. "cde"
  9. -1