ควิซ 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 และ streak

ตัวอย่างคำถาม

ข้อ 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, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง