- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
Java: Find the Bug
This Java quiz shows small programs with a real bug inside, the kind you meet in code reviews and debugging interviews. Predict what actually happens, then pick the fix that makes the code do what was intended.
Pergunta de exemplo
Pergunta 1 de 10This should print the sum of the array. What happens instead?
public class Main {
public static void main(String[] args) {
int[] nums = {1, 2, 3, 4, 5};
int sum = 0;
for (int i = 0; i <= nums.length; i++) {
sum += nums[i];
}
System.out.println(sum);
}
}
Mostrar a resposta
B. ArrayIndexOutOfBoundsException Valid indexes go from 0 to nums.length - 1. With <=, the last iteration reads nums[5] and throws. Use < or a for-each loop.
O que este quiz cobre
- Off-by-one loops and missing initialization
==vsequals()and overloadingequalsby mistake- Ignored return values of immutable
Stringmethods - Integer division and integer overflow in calculations
chararithmetic and silently swallowed exceptions
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.