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 ==.

Facile 10 domande ~5 minuti Superato con il 80% C17

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What 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 int and double in 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.