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:
- y/x;
- z/x;
- y/x + z/x;
- (y + z)/x;
- y % x;
- s.length();
- s.substring(2);
- s.substring(2,5);
- s.indexOf("BCD");
Solution:
- 1
- 1.2
- 2.2
- 2.4
- 2
- 7
- "cdefg"
- "cde"
- -1