What are the five primitive data types?
Integer, Real/Floating Point, Character, String, Boolean.
What is an Integer data type?
A whole number, including zero and negatives, without a fractional part.
What is a Real/Floating Point data type?
A positive or negative number that can have a fractional part.
What is a Character data type?
A single symbol, including letters, numbers, and symbols.
What is a String data type?
A collection of characters, used for storing text.
What is a Boolean data type?
A data type restricted to the values True and False.
How are positive integers represented in binary?
Using base-2, where each bit represents a power of two.
What is the least significant bit (LSB)?
The rightmost bit in a binary number, representing 2^0 (1).
What is the most significant bit (MSB)?
The leftmost bit in a binary number, representing the highest power of two.
What is a byte?
A group of 8 bits.
What is a nybble?
Half a byte; a group of 4 bits.
Convert the binary number 1101 to decimal.
(81)+(41)+(20)+(11) = 13
Convert the decimal number 47 to binary.
101111 (or 00101111 as a byte)
What are the four rules for binary addition?
0+0+0=0; 0+0+1=1; 0+1+1=10; 1+1+1=11
Add the binary numbers 1011 and 1110.
1011 + 1110 = 11001
What is Sign Magnitude representation?
A method where the leftmost bit indicates the sign (0=positive, 1=negative).
How is -173 represented in 9-bit Sign Magnitude if 173 is 10101101?
110101101 (1 added for negative sign)
What is Two’s Complement?
A method where the MSB has a negative weight, simplifying arithmetic.
How do you find the Two’s Complement of a number?
Flip all the bits and add 1.
What is the 8-bit Two’s Complement of 7?
00000111 -> 11111000 -> 11111001
Subtract 12 from 8 using 5-bit Two’s Complement.
8 (01000) + (-12 = 10100) = 11100 (which is -4)
What base is hexadecimal?
Base-16.
What digits and letters are used in hexadecimal?
0-9 and A-F (where A=10, B=11, …, F=15).
Convert the hexadecimal number 4E7F to decimal.
(44096)+(14256)+(716)+(151) = 20095