Binary arithmetic, shifts and hexadecimal
邊玩邊學
回答這些題目賺取能量,接著就能釣魚、探索。不需要帳號。
給教育者: 為 Binary arithmetic, shifts and hexadecimal(Computer Science、Data Representation)準備好可直接使用的課程投影片, 複習筆記——用於你的課程,或把這個主題當成互動班級活動,讓學習者以即時遊戲的方式進行。
課程筆記
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
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
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
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.
投影片
練習題
免費預覽——33 題中的 8 題。註冊即可查看全部。
1.What base does hexadecimal use?
Easy- A16
- B10
- C2
- D8
2.What is binary 1 + 1?
Easy- A10
- B2
- C11
- D0
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.What is F in denary?
Easy- A15
- B16
- C14
- D10
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.What is 00000110 shifted left 1?
Easy- A00001100
- B00000011
- C00001010
- D00001000
7.What is 00001000 shifted right 2?
Easy- A00000010
- B00100000
- C00000100
- D00000001
8.What is 0011 + 0110 in binary?
Easy- A1001
- B1010
- C0111
- D1000
歷屆試題
這個主題的歷屆試題練習即將推出。
即將推出
