Quiz de Java: ArrayList

This Java quiz covers ArrayList, the list you will use most. You will predict what add(), set(), remove() and indexOf() do, see why List.of() refuses changes and learn which operations are fast.

Fácil 10 perguntas ~5 minutos Aprovação com 80% Java 17

Escolha um modo

Jogando como visitante: entre para guardar seu XP e sua sequência.

Pergunta de exemplo

Pergunta 1 de 10

What does this print?

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add(0, "c");
        System.out.println(list);
    }
}
Mostrar a resposta

B. [c, a, b] add(x) appends at the end, but add(0, x) inserts at index 0 and shifts the others right. So c ends up first.

O que este quiz cobre

  • add(), add(index, x) and set()
  • get(), indexOf() and lastIndexOf()
  • remove(Object) and out-of-range indexes
  • List.of() and Arrays.asList() limits
  • Generics need wrapper types like Integer

Perguntas frequentes

Preciso de uma conta?

Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.

Posso refazer?

Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.