資料表示法 Data Representation

ICT Core A3 - 數字系統、字符編碼與多媒體 ICT Core A3 - Number Systems, Character Encoding & Multimedia

學習目錄 Learning Contents

數字系統 Number Systems

二進制、十進制、十六進制與轉換 Binary, Decimal, Hexadecimal & Conversions

字符編碼 Character Encoding

ASCII、Big-5、Unicode 編碼系統 ASCII, Big-5, Unicode Systems

條碼編碼 Barcode Encoding

條碼與 QR Code 的結構與應用 Barcode & QR Code Structure

模擬與數碼 Analog & Digital

模擬資料與數碼資料的轉換 Analog to Digital Conversion

多媒體格式 Multimedia Formats

音訊、視訊、圖像檔案格式 Audio, Video, Image Formats

互動測驗 Interactive Quiz

15 題綜合練習題 15 Comprehensive Questions

學習閃卡 Flashcards

25+ 核心概念卡片 25+ Key Concept Cards

歷屆試題 Past Exam Papers

DSE 模擬題目與詳解 DSE Practice Questions

數字系統與表示法 Number Systems and Representation

數字系統基礎 Number System Basics

電腦使用二進制(Binary)系統來儲存和處理資料,而人類常用十進制(Decimal)系統。十六進制(Hexadecimal)則常用於簡化二進制的表示。

Computers use the Binary system to store and process data, while humans commonly use the Decimal system. Hexadecimal is often used to simplify binary representation.

系統 System 基數 Base 數字範圍 Digit Range 範例 Example
二進制 (Binary) Binary 2 0-1 11012
十進制 (Decimal) Decimal 10 0-9 1310
十六進制 (Hexadecimal) Hexadecimal 16 0-9, A-F D16

資料單位 Data Units

  • Bit (位元)(Binary Digit): 最小的資料單位,只能是 0 或 1Smallest unit of data, can only be 0 or 1
  • Byte (位元組)(8 bits): 8 bits = 1 Byte
  • KB (Kilobyte): 1 KB = 1024 Bytes
  • MB (Megabyte): 1 MB = 1024 KB
  • GB (Gigabyte): 1 GB = 1024 MB
  • TB (Terabyte): 1 TB = 1024 GB

範例 1: 二進制轉十進制 Example 1: Binary to Decimal

將二進制數 $1101_2$ 轉換為十進制:

Convert binary number $1101_2$ to decimal:

$$1101_2 = 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0$$ $$= 8 + 4 + 0 + 1 = 13_{10}$$

範例 2: 十進制轉二進制 Example 2: Decimal to Binary

將十進制數 $45_{10}$ 轉換為二進制(除 2 取餘法):

Convert decimal number $45_{10}$ to binary (division by 2 method):

45 ÷ 2 = 22 ... 1
22 ÷ 2 = 11 ... 0
11 ÷ 2 = 5  ... 1
5  ÷ 2 = 2  ... 1
2  ÷ 2 = 1  ... 0
1  ÷ 2 = 0  ... 1
                    

由下往上讀取餘數:$45_{10} = 101101_2$

Read remainders from bottom to top: $45_{10} = 101101_2$

二補數 (Two's Complement) Two's Complement

二補數是電腦用來表示有符號整數(包括負數)的方法。

Two's complement is the method computers use to represent signed integers (including negative numbers).

計算二補數的方法 Methods to Calculate Two's Complement

  1. 方法一:從 $2^n$ 減去該數(n 為位元數)
  2. Method 1: Subtract the number from $2^n$ (n is the number of bits)
  3. 方法二:將該數的一補數(反轉所有位元)加 1
  4. Method 2: Add 1 to the one's complement (invert all bits)

範例:計算 -27 的 8-bit 二補數 Example: Calculate 8-bit Two's Complement of -27

步驟 1:將 27 轉為 8-bit 二進制

Step 1: Convert 27 to 8-bit binary

$27_{10} = 00011011_2$

步驟 2:反轉所有位元(一補數)

Step 2: Invert all bits (one's complement)

$11100100_2$

步驟 3:加 1

Step 3: Add 1

$$11100100_2 + 1 = 11100101_2$$

因此,-27 的 8-bit 二補數表示為 $11100101_2$

Therefore, the 8-bit two's complement of -27 is $11100101_2$

溢位錯誤 (Overflow Error) Overflow Error

當計算結果超出電腦可表示的範圍時,就會發生溢位錯誤。

An overflow error occurs when a calculation result exceeds the range that a computer can represent.

範例:4-bit 無符號整數溢位 Example: 4-bit Unsigned Integer Overflow

4-bit 無符號整數可表示範圍:0 到 15

4-bit unsigned integer range: 0 to 15

計算 $9 + 9$:

Calculate $9 + 9$:

  1001  (9)
+ 1001  (9)
-------
 10010  (18)
                        

結果需要 5 個位元,但只有 4 個位元可用

Result requires 5 bits, but only 4 bits available

捨棄最高位元後:$0010_2 = 2_{10}$(錯誤結果)

After discarding the highest bit: $0010_2 = 2_{10}$ (incorrect result)

字符編碼系統 Character Encoding Systems

字符編碼比較 Character Encoding Comparison

編碼系統 Encoding System 位元數 Bits 字符集大小 Character Set Size 支援語言 Supported Languages
ASCII 7-8 bits 128 字符characters 英文、數字、符號 English, numbers, symbols
Big-5 碼Code 2 bytes (16 bits) ~13,000 字符characters 繁體中文、英文 Traditional Chinese, English
GB 碼Code 2 bytes (16 bits) ~7,000 字符characters 簡體中文、英文 Simplified Chinese, English
Unicode (UTF-8/UTF-16) 1-4 bytes 1,000,000+ 字符characters 多語言支援 Multi-language support

ASCII

ASCII(美國標準資訊交換碼)使用 7 位元(擴展版本使用 8 位元),可表示 128 個字符,包括:

ASCII (American Standard Code for Information Interchange) uses 7 bits (extended version uses 8 bits), representing 128 characters, including:

  • 大小寫英文字母(A-Z, a-z)
  • Uppercase and lowercase letters (A-Z, a-z)
  • 數字(0-9)
  • Numbers (0-9)
  • 標點符號和特殊字符
  • Punctuation and special characters
  • 控制字符(如換行、回車)
  • Control characters (e.g., newline, carriage return)

ASCII 範例 ASCII Examples

'A' = 6510 = 010000012

'a' = 9710 = 011000012

'0' = 4810 = 001100002

Big-5 碼Code

Big-5 碼是台灣和香港常用的繁體中文編碼系統:

Big-5 code is a Traditional Chinese encoding system commonly used in Taiwan and Hong Kong:

  • 使用 2 個位元組(16 位元)編碼每個中文字
  • Uses 2 bytes (16 bits) to encode each Chinese character
  • 可表示約 13,000 個繁體中文字
  • Can represent approximately 13,000 Traditional Chinese characters
  • 也支援英文字母(使用 1 個位元組)
  • Also supports English letters (using 1 byte)

Unicode

Unicode 是現代最廣泛使用的字符編碼標準:

Unicode is the most widely used modern character encoding standard:

  • 支援世界上幾乎所有語言和符號
  • Supports almost all languages and symbols in the world
  • 使用可變長度編碼(1-4 個位元組)
  • Uses variable-length encoding (1-4 bytes)
  • UTF-8:最常用的 Unicode 實現方式
  • UTF-8: Most commonly used Unicode implementation
  • UTF-16:使用 2 或 4 個位元組
  • UTF-16: Uses 2 or 4 bytes

Unicode 優勢 Unicode Advantages

  • 單一編碼系統支援多種語言
  • Single encoding system supports multiple languages
  • 避免不同編碼系統間的轉換問題
  • Avoids conversion issues between different encoding systems
  • 支援表情符號(emoji)和特殊符號
  • Supports emojis and special symbols

條碼編碼 Barcode Encoding

條碼結構 Barcode Structure

標準條碼(如 EAN-13、UPC)包含以下元素:

Standard barcodes (e.g., EAN-13, UPC) contain the following elements:

  • 靜區Quiet Zone: 條碼兩端的空白區域,確保掃描器正確識別Blank areas at both ends ensuring correct scanner recognition
  • 起始/終止字符Start/End Characters: 標示條碼的開始和結束Mark the beginning and end of the barcode
  • 資料區Data Area: 使用不同寬度的黑白線條編碼資訊Encodes information using black and white bars of different widths
  • 檢查碼Check Digit: 用於驗證掃描的準確性Used to verify scanning accuracy

QR Code

QR Code(快速回應碼)是二維條碼,相比傳統一維條碼有以下優勢:

QR Code (Quick Response Code) is a 2D barcode with the following advantages over traditional 1D barcodes:

特性 Feature 傳統條碼 Traditional Barcode QR Code
掃描方向 Scan Direction 單向(水平) Unidirectional (horizontal) 任意方向 Any direction
儲存容量 Storage Capacity 數字/字母(有限) Numbers/letters (limited) 數千字符 Thousands of characters
錯誤修正 Error Correction 無或有限 None or limited 最高 30% Up to 30%
字符支援 Character Support 數字、英文字母 Numbers, English letters Unicode (多語言)(multilingual)
資料類型 Data Types 產品代碼 Product codes URL, 文字text, 聯絡資訊contact info

QR Code 應用 QR Code Applications

  • 行動支付(如 PayMe、AlipayHK)
  • Mobile payments (e.g., PayMe, AlipayHK)
  • 網址連結(快速訪問網站)
  • URL links (quick website access)
  • 產品追蹤與驗證
  • Product tracking and verification
  • 活動簽到與票務管理
  • Event check-in and ticketing
  • 名片與聯絡資訊分享
  • Business cards and contact info sharing

模擬與數碼資料 Analog and Digital Data

模擬資料 vs 數碼資料 Analog Data vs Digital Data

特性 Feature 模擬資料 Analog Data 數碼資料 Digital Data
定義 Definition 連續變化的數值 Continuously varying values 離散的數值(0 和 1) Discrete values (0 and 1)
範例 Examples 溫度、聲音波形、光線強度 Temperature, sound waves, light intensity MP3, JPEG, 數碼照片digital photos
儲存 Storage 需轉換為數碼格式 Needs conversion to digital format 直接儲存於電腦 Directly stored in computers
傳輸 Transmission 易受干擾和失真 Susceptible to interference and distortion 抗干擾、可壓縮 Resistant to interference, compressible
複製 Copying 品質會逐代降低 Quality degrades with each copy 完美複製,無損失 Perfect copying, no loss

數碼化過程 (Digitalisation) Digitalisation Process

將模擬資料轉換為數碼資料需要兩個步驟:

Converting analog data to digital data requires two steps:

1. 離散化 (Discretisation) 1. Discretisation

在固定時間間隔對模擬訊號進行取樣(採樣)。

Sampling the analog signal at fixed time intervals.

  • 採樣率 (Sampling Rate)Sampling Rate: 每秒取樣的次數Number of samples per second
  • 採樣率越高,數碼資料越接近原始模擬訊號
  • Higher sampling rate = digital data closer to original analog signal
  • 常見音訊採樣率:44.1 kHz(CD 品質)、48 kHz、96 kHz
  • Common audio sampling rates: 44.1 kHz (CD quality), 48 kHz, 96 kHz

2. 量化 (Quantisation) 2. Quantisation

將每個取樣值轉換為最接近的離散數值。

Converting each sample value to the nearest discrete value.

  • 使用有限的位元數表示每個取樣值
  • Uses a limited number of bits to represent each sample
  • 位元深度越高,量化誤差越小
  • Higher bit depth = smaller quantisation error
  • 常見音訊位元深度:16-bit(CD)、24-bit、32-bit
  • Common audio bit depths: 16-bit (CD), 24-bit, 32-bit

採樣率對品質的影響 Impact of Sampling Rate on Quality

範例:音訊採樣 Example: Audio Sampling

  • 低採樣率(8 kHz):電話品質,聲音較模糊
  • Low sampling rate (8 kHz): Telephone quality, muffled sound
  • 中採樣率(22.05 kHz):網路串流音訊
  • Medium sampling rate (22.05 kHz): Web streaming audio
  • 高採樣率(44.1 kHz):CD 品質,接近人耳聽覺極限
  • High sampling rate (44.1 kHz): CD quality, near human hearing limit
  • 超高採樣率(96 kHz+):專業錄音,檔案更大
  • Very high sampling rate (96 kHz+): Professional recording, larger files

光學字符識別 (OCR) Optical Character Recognition (OCR)

OCR 是將印刷或手寫文字的圖像轉換為可編輯數碼文字的技術。

OCR is the technology that converts images of printed or handwritten text into editable digital text.

OCR 應用 OCR Applications

  • 掃描紙本文件並轉換為可編輯文字
  • Scanning paper documents and converting to editable text
  • 自動車牌識別系統
  • Automatic license plate recognition systems
  • 銀行支票處理
  • Bank check processing
  • 數碼化歷史文獻
  • Digitizing historical documents

多媒體檔案格式 Multimedia File Formats

檔案格式與副檔名 File Formats and Extensions

副檔名是檔案名稱末尾的標識符,用於指示檔案類型和格式。

File extensions are identifiers at the end of filenames indicating file type and format.

音訊格式 Audio Formats

格式 Format 副檔名 Extension 特性 Characteristics
MP3 .mp3 有損壓縮,檔案小,廣泛支援 Lossy compression, small file size, widely supported
WAV .wav 無損格式,檔案大,高品質 Lossless format, large file size, high quality
AAC .aac, .m4a 比 MP3 更高效的壓縮 More efficient compression than MP3
FLAC .flac 無損壓縮,檔案較小 Lossless compression, smaller file size

視訊格式 Video Formats

格式 Format 副檔名 Extension 特性 Characteristics
MP4 .mp4 最常用,支援度高,平衡品質與檔案大小 Most common, high compatibility, balanced quality and size
AVI .avi 較舊格式,檔案較大 Older format, larger file size
MOV .mov Apple QuickTime 格式 Apple QuickTime format
WebM .webm 開源格式,適合網頁串流 Open-source format, suitable for web streaming

圖像格式 Image Formats

格式 Format 副檔名 Extension 特性 Characteristics
JPEG .jpg, .jpeg 有損壓縮,適合照片 Lossy compression, suitable for photos
PNG .png 無損壓縮,支援透明背景 Lossless compression, supports transparency
GIF .gif 支援動畫,256 色限制 Supports animation, 256 color limit
WebP .webp Google 開發,壓縮效率高 Developed by Google, high compression efficiency
SVG .svg 向量圖形,可無限縮放 Vector graphics, infinitely scalable

元資料 (Metadata) Metadata

元資料是描述檔案本身的資料,包含在檔案標頭中。

Metadata is data that describes the file itself, contained in the file header.

常見元資料類型 Common Metadata Types

  • 圖像元資料:解析度、色彩深度、拍攝日期、相機型號、GPS 位置
  • Image metadata: Resolution, color depth, capture date, camera model, GPS location
  • 音訊元資料:演唱者、專輯名稱、年份、曲目編號、採樣率、位元率
  • Audio metadata: Artist, album name, year, track number, sampling rate, bit rate
  • 視訊元資料:解析度、影格率、編碼格式、時長、創作日期
  • Video metadata: Resolution, frame rate, codec, duration, creation date
  • 文件元資料:作者、標題、創建日期、修改日期、關鍵字
  • Document metadata: Author, title, creation date, modification date, keywords

元資料的用途 Uses of Metadata

  • 檔案管理與搜尋
  • File management and search
  • 版權保護與追蹤
  • Copyright protection and tracking
  • 自動分類與整理
  • Automatic categorization and organization
  • 軟體正確解讀檔案格式
  • Software correctly interprets file format

互動測驗 Interactive Quiz

學習閃卡 Learning Flashcards

點擊卡片翻轉查看答案 Click cards to flip and see answers

歷屆試題 Past Exam Questions

使用 made with 製作