Kablow!

Binary arithmetic, shifts and hexadecimal

Học bằng cách chơi

Trả lời những câu hỏi này để kiếm năng lượng, rồi câu cá và khám phá. Không cần tài khoản.

Dành cho nhà giáo dục: slide bài học, ghi chú ôn tập sẵn dùng cho Binary arithmetic, shifts and hexadecimal (Computer Science, Data Representation) — dùng trong bài giảng của bạn, hoặc chạy chủ đề như một hoạt động lớp học tương tác để người học chơi như một trò chơi trực tiếp.

Ghi chú bài học

Binary addition

  • Rules: 0+0 = 0; 0+1 = 1; 1+1 = 10 (write 0, carry 1); 1+1+1 = 11 (write 1, carry 1).
  • Example: 0101 + 0011 = 1000 (5 + 3 = 8).
  • Overflow: if the result needs more bits than are available (e.g. an 8-bit register gets a 9th bit), the extra bit is lost, giving a wrong answer.

Adding unsigned values

Adding unsigned valuesOperationBinaryDenary00000101 + 00000011000010005 + 3 = 811111111 + 00000001100000000255 + 1 = 2568-bit result after overflow000000000; carry cannot fit

Binary shifts

  • A left shift moves bits left, filling with 0s: it multiplies an unsigned value by 2 for each place, provided no significant bit is lost. 00001100 (12) shifted left 2 = 00110000 (48).
  • A right shift moves bits right, filling with 0s: it divides by 2 (rounding down) for each place. 00001100 shifted right 1 = 00000110 (6).
  • Bits shifted off the end are lost.

Unsigned eight-bit shifts

Unsigned eight-bit shiftsOperationBit patternValueOriginal0000110012Left one0001100024Right one000001106Left two0011000048

Hexadecimal

  • Hexadecimal (base 16) uses digits 0-9 and A-F (A=10 ... F=15).
  • Binary to hex: split into 4-bit groups (nibbles). 1010 1111 → A F → AF. Hex to binary: convert each digit: 3C → 0011 1100.
  • Hex to denary: 3C = 3×16 + 12 = 60. Denary to hex: 255 = FF.

Four bits per hex digit

Four bits per hex digitHex digitFour bitsDenary300113601106A101010C110012F111115

Why hex?

  • Hex is shorter and easier for humans to read and write than long binary: colour codes (#FF0000), memory addresses, MAC addresses and error codes.

Slide

Sign up free to view the lesson slides

Step through every slide for this topic — plus flashcards and revision notes — with a free account.

Câu hỏi luyện tập

Xem trước miễn phí — 8 trên 33 câu hỏi. Đăng ký để xem tất cả.
  1. 1.What base does hexadecimal use?

    Easy
    • A16
    • B10
    • C2
    • D8
  2. 2.What is binary 1 + 1?

    Easy
    • A10
    • B2
    • C11
    • D0
  3. 3.What does overflow mean?

    Easy
    • Athe result is too big for the bits available
    • Bthe result is zero
    • Cthe result is negative
    • Dthe loop ends
  4. 4.What is F in denary?

    Easy
    • A15
    • B16
    • C14
    • D10
  5. 5.For an unsigned binary value, with no significant bit lost, what is the effect of a one-place left shift?

    Easy
    • Adoubles the value
    • Bhalves the value
    • Cadds 1
    • Dsubtracts 1
  6. 6.What is 00000110 shifted left 1?

    Easy
    • A00001100
    • B00000011
    • C00001010
    • D00001000
  7. 7.What is 00001000 shifted right 2?

    Easy
    • A00000010
    • B00100000
    • C00000100
    • D00000001
  8. 8.What is 0011 + 0110 in binary?

    Easy
    • A1001
    • B1010
    • C0111
    • D1000

Unlock all 33 questions & more

Tạo tài khoản miễn phí để xem mọi câu hỏi, slide, thẻ ghi nhớ và ghi chú ôn tập cho chủ đề này.

Đề thi cũ

Luyện đề thi cũ cho chủ đề này sắp ra mắt.
Sắp ra mắt