✕ Close

Week 15 · 15.5 · Fri, Nov 13 · Do Now

Do Now

Work every question in your notebook. Do it on your Chromebook with your ID.

  1. Predict

    What is printed?

    System.out.println("Bus " + 4 + 2);
    1. Bus 42
    2. Bus 6
    3. 42
    4. Bus 4 + 2
  2. Predict

    What is printed? The first line printed is first.

    System.out.println(5 + 2 + " laps");
    System.out.println("laps: " + 5 + 2);
    1. 7 laps, then laps: 52
    2. 52 laps, then laps: 52
    3. 7 laps, then laps: 7
    4. 52 laps, then laps: 7
  3. Error analysis

    first holds Mia and last holds Cruz. A student wanted Mia Cruz, but System.out.println(first + last); prints MiaCruz. What is the mistake?

    1. + never adds a space, so the line needs " " joined between first and last.
    2. last needs quotation marks around it.
    3. + should be - between the two strings.
    4. println should be print.
  4. Length

    What is printed?

    String s = "Hi";
    s = s + " there";
    System.out.println(s.length());
    1. 8
    2. 7
    3. 2
    4. Hi there
  5. Output

    Write exactly what is printed, one line for each println.

    String pet = "Rex";
    int age = 6;
    System.out.println(pet + " is " + age);
    System.out.println(age + 2 + " in two years");
    System.out.println("In two years: " + age + 2);