CS 1713 Introduction to Computer Science: Midterm 2 Topics


The most important things you need to know how to do for midterm exam 2:


Here are a couple of sample problems:

  1. Evaluate each of the following, given:
    String s = "ABCdefGH";
    1. s.indexOf("def");
    2. s.indexOf("DEF");
    3. s.substring(2,5);
    4. s.substring(4);
    5. s.charAt(4);
  2. Draw an accurate schematic diagram of the program variables showing the execution of the program.
    int z = 5;
    int[] x = {10, 20, 30, 40};
    int[] y;
    String s = "abc def";
    String[] t = {"xyz", "uvw", "abcdefg"};
    String[] u;
    y = x;
    x[2] = 7;
    z = y[2];
    u = t;
    u[0] = s;
    s = t[2];