- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di Java: if, switch & Loops
This Java control flow quiz checks how if, switch, for, while and do-while really run. You will trace loops with break and continue, catch switch fall-through and spot loops that never end or run past an array.
Domanda di esempio
Domanda 1 di 10What does this print?
public class Main {
public static void main(String[] args) {
int day = 2;
switch (day) {
case 1: System.out.print("A");
case 2: System.out.print("B");
case 3: System.out.print("C");
break;
default: System.out.print("D");
}
System.out.println();
}
}
Mostra la risposta
C. BC The switch jumps to case 2 and then falls through into case 3 because there is no break after B. The break after C stops it before default.
Cosa copre questo quiz
- Classic
switchfall-through andbreak - Switch expressions with
-> for, enhancedfor,whileanddo-whilebreakandcontinue- Common bugs like off-by-one and infinite loops
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.