C Operators & Integer Division Quiz

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

Easy 10 questions ~5 minutes Pass at 80% C17

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

#include <stdio.h>

int main(void) {
    printf("%d\n", 7 / 2);
    return 0;
}
Show the answer

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.

What this quiz covers

  • Integer division drops the fraction
  • % and negative numbers
  • Mixing int and double in an expression
  • Post-increment and operator precedence
  • = vs == and short-circuit &&

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.