Number Systems, Data Representation, and Compression
Number Systems
Hexadecimal
There is no single symbol (digit) to represent 16 in hexadecimal. The hexadecimal number 10 corresponds to the decimal value 16.
Binary
The devices used to store and manage data on a computer are cheaper and more reliable if they only have to represent two possible states. Every electrical signal is considered to be either “low” or “high” that map to the binary digits 0 and 1.
There are 2 digits in the binary number system.
Decimal
There are 10 digits in the decimal number system.
Hexadecimal
There are 16 digits in the hexadecimal number system.
Octal
There are 8 digits in the octal number system.
Decimal Value of Hexadecimal Digits
The decimal value of the largest digit in the hexadecimal number system is 15.
Lowest Base for Valid Numbers
- 10: Binary
- 1000: Binary
- 987: Decimal
Binary to Decimal Conversion
11011011 = 219
Decimal to Binary Conversion
297 = 0100101001
Hexadecimal to Binary Conversion
9CB = 100111001011
Binary Addition
11001 + 1110011 = 10001100
Base-13 to Decimal Conversion
135 = 465
Hexadecimal to Decimal Conversion
1C9F = 7327
Octal to Decimal Conversion
135 = 93
Byte
A group of eight bits is called a byte.
Base-13 to Hexadecimal Conversion
998 = 66E
Binary to Hexadecimal Conversion
11011011 = DB
Power of Zero
The rightmost digit represents its value multiplied by the base raised to the zeroth power.
Octal Number System
Octal is the lowest number system in which 372 could be a valid number.
Hexadecimal Base
False: The base of the hexadecimal number system is 15.
Integers
True: The category of numbers called integers includes negative numbers.
Hexadecimal Representation of 11
False: The letter C is used to represent the number 11 in hexadecimal.
Binary to Hexadecimal Conversion
True: Starting from the right, every group of four binary digits can be read as one hexadecimal digit.
Data Representation
Analog vs. Digital Signals
Both types of signal represent the voltage level on a line. The voltage of an analog signal fluctuates continuously through its range, creating a smooth wave, whereas the voltage of a digital signal jumps from a high extreme to a low extreme, creating a blocky wave. An analog signal fluctuates in direct proportion to the information it represents, such as a sound wave, whereas, a digital signal represents binary digits corresponding to the two extremes. Both signals degrade, but a digital signal loses less information since there are only two possibilities to consider.
Keyword vs. Huffman Encoding
Both encoding techniques are an attempt to compress the size of textual data. Keyword encoding substitutes common words with a single character but uses the same length binary string to represent every character. Huffman uses different size binary strings for each character, using shorter strings for frequent characters and longer strings for infrequent characters.
Compression Ratio
The size of the compressed data divided by the size of the original data is 3/4. Thus, the data was compressed by 25%.
Number of Things Represented by n Bits
2n
Number of Things Represented by Bits
- 4 bits: 16
- 3 bits: 8
Sampling
Recording the voltage level of an audio signal at regular intervals is called sampling.
Keyword Encoding
Which text compression technique replaces a frequently used word with a single character? Keyword encoding
Runlength Encoding
Which text compression technique replaces a long series of repeated characters with a count of the repetition? Runlength encoding
Huffman Encoding
Which text compression technique uses variable-length binary strings to represent characters, assigning frequently used characters short codes? Huffman Encoding
Data Compression
Data compression is the process of reducing the amount of space needed to store a piece of data.
Three Bits
Three bits can represent up to 8 unique things
Overflow
Overflow occurs when a calculated value cannot fit into the number of digits reserved for it.
RGB Value
True: A RGB value is made up of three values that represent the relative contributions of the primary colors red, green, and blue.
Two Bits
True: It’s possible to represent four things with two bits.
JPEG vs. GIF
True: The JPEG image format is best used for line art, while the GIF format is superior for photographic images.
Binary Addition
11001 + 1110011 = 10001100
Assembly Language
Assembler
Assembler is a program that translates an assembly-language program into machine code.
Test Plan
Test plan is a document that specifies how a program is to be tested.
Assembly-Language Program
An assembly-language program uses mnemonics to represent instructions.
Input to Assembler
the input to an assembler is a(n machine language program
Machine Language Instruction
False: Each machine language instruction performs a single complex task, such as sorting a list of numbers.
Machine Language
True: Machine language is the set of binary-coded instructions that are executed directly by a computer.
Loader
True: The loader is software that puts a machine-language program into memory so that it can be executed.
Machine Language Today
. T
Derive the algorithm for writing “Hi” on the screen if the implementation language is Pep/8 assembly language.
Original:
Write “HI”
This can be refined to:
Write “HI”
Write “H”
Write “I”
No further refinement is necessary because these are concrete steps in assembly language.
