Skip to content
KALANBLON
Show contents

Chapter 6 of 6 · 10 min

Quiz: repeating

Loops, arrays and ArrayList: let's check that you've mastered repetition in Java. You need 70% correct answers.

Quiz

6 questions · pass mark: 70%

  1. 1.How many times does this loop display "*"?

    One answer

    for (int i = 3; i < 9; i += 2) {
        IO.print("*");
    }
  2. 2.What is the last valid index of the array int[] t = new int[10];?

    One answer

  3. 3.What does this code display?

    One answer

    var l = new ArrayList<String>();
    l.add("a");
    l.add("b");
    l.add(0, "z");
    IO.println(l);
  4. 4.Fill in the blank to get the number of items in the list.

    Complete the code

    int n = guests.____();
  5. 5.Which statements are true? (several answers)

    Several answers possible

  6. 6.What do you need to display the contents of an int[] t readably?

    One answer

Your progress is saved on this device. Create a free account to keep your progress on all your devices.