Квиз по 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 ==.

Лёгкий 10 вопроса ~5 минуты Проходной балл: 80% C17

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

#include <stdio.h>

int main(void) {
    printf("%d\n", 7 / 2);
    return 0;
}
Показать ответ

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.

Что проверяет этот квиз

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

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.