Back to COMP1521 Overview 返回 COMP1521 总览

COMP1521 Week 10 Quiz

Floating Point & Text Encoding

IEEE-754标准、浮点数精度问题、字符编码与Unicode

Question 1

What is the primary purpose of the IEEE-754 standard?

A) To define character encoding standards
B) To standardize floating-point arithmetic across different computer systems
C) To specify integer representation formats
D) To define network protocols
Question 2

How many bits are used for the exponent in IEEE-754 single precision (32-bit) format?

A) 7 bits
B) 8 bits
C) 11 bits
D) 23 bits
Question 3

What is the bias value used for the exponent in IEEE-754 single precision?

A) 126
B) 127
C) 128
D) 255
Question 4

Which exponent value represents infinity in IEEE-754?

A) All zeros (0)
B) All ones (maximum value)
C) Exactly half the maximum value
D) The bias value (127 for single precision)
Question 5

What condition results in NaN (Not a Number) in IEEE-754?

A) Exponent all ones AND significand all zeros
B) Exponent all ones AND significand non-zero
C) Exponent all zeros AND significand non-zero
D) All bits are zero
Question 6

What is the approximate range of positive normalized numbers in IEEE-754 single precision?

A) 10^-38 to 10^38
B) 10^-308 to 10^308
C) 2^-126 to 2^127
D) 10^-128 to 10^127
Question 7

How many bits are used for the mantissa (significand) in IEEE-754 double precision?

A) 23 bits
B) 52 bits
C) 53 bits
D) 64 bits
Question 8

What is "catastrophic cancellation" in floating-point arithmetic?

A) When addition causes overflow
B) When subtracting nearly equal numbers results in loss of significant digits
C) When division by zero occurs
D) When multiplication causes underflow
Question 9

What is the decimal value of the IEEE-754 single precision number: 0x3F800000?

A) 0.0
B) 1.0
C) 2.0
D) -1.0
Question 10

Which of the following is NOT a valid IEEE-754 special value?

A) +Infinity
B) -Infinity
C) NaN
D) Undefined
Question 11

What is the primary advantage of Unicode over ASCII?

A) Unicode uses fewer bits per character
B) Unicode can represent characters from all world languages
C) Unicode is easier to implement
D) Unicode is faster to process
Question 12

How many bits does ASCII use to represent each character?

A) 6 bits
B) 7 bits
C) 8 bits
D) 16 bits
Question 13

What is a Unicode code point?

A) A specific encoding format
B) A unique number assigned to each character
C) A font representation
D) A keyboard mapping
Question 14

Which UTF encoding is backward compatible with ASCII?

A) UTF-7
B) UTF-8
C) UTF-16
D) UTF-32
Question 15

How many bytes does UTF-8 use to encode ASCII characters?

A) 1 byte
B) 2 bytes
C) 3 bytes
D) 4 bytes
Question 16

What is the maximum number of bytes UTF-8 can use for a single character?

A) 2 bytes
B) 3 bytes
C) 4 bytes
D) 6 bytes
Question 17

Which UTF encoding uses a fixed size of 2 bytes per character?

A) UTF-8
B) UTF-16
C) UTF-32
D) None of the above
Question 18

What is the purpose of the Byte Order Mark (BOM) in Unicode?

A) To mark the beginning of a file
B) To indicate the byte order (endianness) of the text
C) To indicate the encoding type
D) Both B and C
Question 19

What is machine epsilon in floating-point arithmetic?

A) The smallest positive normalized number
B) The difference between 1.0 and the next representable number
C) The largest representable number
D) The rounding error threshold
Question 20

What happens when you add a very small number to a very large number in floating-point arithmetic?

A) The result is always exact
B) The small number may be lost due to limited precision
C) An overflow occurs
D) The result is always zero
Question 21

What is denormalized (subnormal) numbers in IEEE-754?

A) Numbers with exponent all ones
B) Numbers with exponent all zeros and non-zero significand
C) Numbers with negative exponents
D) Numbers that cannot be represented
Question 22

What is the Unicode code point for the character 'A'?

A) U+0041
B) U+0061
C) U+0065
D) 65
Question 23

How does UTF-8 encode characters outside the ASCII range?

A) Using 2 bytes with both bits set to 1
B) Using multiple bytes where the first byte indicates the total byte count
C) Using escape sequences
D) UTF-8 cannot encode non-ASCII characters
Question 24

What is the main disadvantage of UTF-32 compared to UTF-8?

A) UTF-32 is slower to process
B) UTF-32 uses 4 bytes for every character, wasting space for ASCII
C) UTF-32 cannot represent all Unicode characters
D) UTF-32 is not standardized
Question 25

What is "rounding error" in floating-point arithmetic?

A) When a calculation results in overflow
B) When a number cannot be represented exactly and must be approximated
C) When division by zero occurs
D) When using integer arithmetic instead of floating-point
Question 26

Which encoding is most efficient for text that is primarily in English?

A) UTF-32
B) UTF-16
C) UTF-8
D) ASCII
Question 27

What is the purpose of the "hidden bit" in IEEE-754 normalized numbers?

A) To indicate the sign of the number
B) To provide an extra bit of precision by assuming the leading bit is 1
C) To mark special values like NaN
D) To store the exponent bias
Question 28

How many bits are used for the entire IEEE-754 double precision format?

A) 32 bits
B) 64 bits
C) 80 bits
D) 128 bits
Question 29

What is the Unicode code point range for basic multilingual plane (BMP) characters?

A) U+0000 to U+00FF
B) U+0000 to U+FFFF
C) U+0000 to U+10FFFF
D) U+10000 to U+10FFFF
Question 30

What is the decimal value of the IEEE-754 single precision number: 0xBF800000?

A) 0.0
B) 1.0
C) -1.0
D) -2.0
Question 31

Which of the following operations typically results in loss of precision?

A) Adding two integers
B) Converting from double to float
C) Multiplying by powers of 2
D) Comparing two floats for equality
Question 32

What is the purpose of surrogate pairs in UTF-16?

A) To handle byte order
B) To represent characters outside the Basic Multilingual Plane
C) To compress text
D) To handle error correction
Question 33

What is the main difference between ISO-8859-1 (Latin-1) and ASCII?

A) Latin-1 uses 7 bits, ASCII uses 8 bits
B) Latin-1 extends ASCII to include Western European characters
C) Latin-1 supports Asian characters
D) No significant difference
Question 34

What is the purpose of floating-point normalization?

A) To make numbers positive
B) To maximize precision by ensuring the leading bit is 1
C) To handle overflow conditions
D) To convert between different formats
Question 35

Which encoding uses variable-length encoding similar to UTF-8 but with different byte patterns?

A) UTF-7
B) UTF-16
C) GB18030
D) Shift-JIS
Question 36

What is the decimal value of pi (π) approximately in IEEE-754 single precision?

A) Exactly 3.141592653589793
B) Approximately 3.1415927 (rounded to 7 decimal places)
C) Exactly 22/7
D) Cannot be represented exactly
Question 37

What is the Unicode character '€' (Euro sign) code point?

A) U+0080
B) U+20AC
C) U+2122
D) U+00A5
Question 38

What happens when you compare two floating-point numbers for exact equality?

A) It always works correctly
B) It often fails due to rounding errors in calculations
C) It causes overflow
D) It is faster than using an epsilon tolerance
Question 39

What is the UTF-8 encoding for the Unicode code point U+00A9 (© symbol)?

A) 0xA9
B) 0xC2 0xA9
C) 0xA9 0x00
D) 0x00 0xA9
Question 40

What is the main advantage of using floating-point numbers over fixed-point numbers?

A) Floating-point is always more precise
B) Floating-point can represent a much wider range of values
C) Floating-point calculations are always faster
D) Floating-point uses less memory