Data representation Flashcards
What do computers use to represent all types of data?
Binary (0s and 1s) are used to store numbers, text, colors, images, and videos.
Why do computers use binary?
Binary is based on electronic signals that can be ON (1) or OFF (0).
What is a logic gate?
A circuit that performs logical operations (AND, OR, NOT).
What is a truth table?
Shows all possible inputs and the result for each in a logic gate
What is a bit?
A single binary digit (0 or 1).
What is a byte?
8 bits grouped together.
What is a nibble?
4 bits grouped together.
How many possible values can a byte store?
256 values (2⁸).
How does binary counting work?
Same as decimal, but only using 0 and 1 (e.g., 0, 1, 10, 11, 100, 101, etc.).
How do you convert binary to decimal?
Multiply each bit by 2 to the power of its position, then add them all up
How do you convert decimal to binary?
Divide by 2, keep track of remainders, and read from bottom up.
What is ASCII?
A 7-bit character encoding system for text.
What is Unicode?
A way to represent text that works with many languages and symbols, like UTF-8, UTF-16, and UTF-32.
How are colors represented in binary?
Using RGB (Red, Green, Blue), each color is 8 bits, making a 24-bit color system.
What is a hexadecimal number?
A base-16 number system using digits 0-9 and letters A-F.
How do you convert hexadecimal to binary?
Change each hex digit into 4 binary bits
How do you convert binary to hexadecimal?
Group bits into 4s from right to left, then convert each group to hex.
What is an 8-bit color system?
Uses 256 colors (2⁸).
What is the difference between sign-and-magnitude and two’s complement?
Sign-and-magnitude uses the first bit to show sign. Two’s complement shows negatives in a different way
How do you find the two’s complement of a number?
Flip the bits and add 1.
How does a computer perform binary addition?
Similar to decimal, but using carry rules for 1 + 1.
How does a computer perform binary subtraction?
Uses two’s complement to turn subtraction into addition.
What is binary multiplication by powers of 2?
Shifting left multiplies by 2, shifting right divides by 2.
What is overflow in binary arithmetic?
Happens when the result is too big for the number of bits allowed
What is floating-point representation?
A way to store real numbers using a sign bit, exponent, and mantissa.
What is fixed-point representation?
A way to show real numbers with the decimal point always in the same place
What is IEEE 754 format?
A standard way to store decimal numbers using 32 or 64 bits
How do you add floating-point numbers?
Match the exponents, add the mantissas, then adjust the result
Why is data representation important?
Makes sure data is stored efficiently and calculations are accurate in digital systems