- 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 C: if, switch & Loops
This C quiz checks how well you can follow the control flow of a program. You will trace if/else, switch with and without break, and for, while and do-while loops, and spot small bugs like a stray semicolon.
Domanda di esempio
Domanda 1 di 10What does this print?
#include <stdio.h>
int main(void) {
int x = 2;
switch (x) {
case 1: printf("one ");
case 2: printf("two ");
case 3: printf("three");
break;
default: printf("other");
}
printf("\n");
return 0;
}
Mostra la risposta
B. two three switch jumps to case 2 and then falls through into the following cases until it reaches a break. So it prints two and three, and the break stops it before default.
Cosa copre questo quiz
switchfall-through andbreakfor,whileanddo-whileloopsbreakandcontinue- Which
ifanelsebelongs to - What counts as true in C
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.