- 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: Operators & Integer Division
This C quiz is about the arithmetic operators and the surprises of integer division. You will predict what /, %, ++ and mixed expressions give and spot classic operator bugs like = instead of ==.
Domanda di esempio
Domanda 1 di 10What does this print?
#include <stdio.h>
int main(void) {
printf("%d\n", 7 / 2);
return 0;
}
Mostra la risposta
D. 3 Both operands are int, so / does integer division and throws away the fraction. The result is 3, not rounded up to 4 and never 3.5.
Cosa copre questo quiz
- Integer division drops the fraction
%and negative numbers- Mixing
intanddoublein an expression - Post-increment and operator precedence
=vs==and short-circuit&&
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.