Title: CSE 351 23au / LS4 Data III, Integers I

Q: True or False: Bitwise operators can be used on any data types. (integer, floating point, char, etc)
A: False, bitwise operators can only be used on integral data types (e.g., char, short, int, long)

Q: What do we use to apply boolean operations on bits of the operand(s)?
A: Bitwise operators

Q: A function of a specific vector (i.e., a string of bits) combined with a two-input bitwise operator is known as a ___
A: Bitmask
Vector: 11110000
Operator: | (or)

Q: The bitwise operator that outputs 1 only when both input bits are 1 is the ___ operator
A: & (AND)

Q: The bitwise operator that outputs 1 when either input bit is 1 is the ___ operator
A: | (OR)

Q: The bitwise operator that outputs 1 when either input is exclusively 1 is the ___ operator
A: ^ (XOR)

Q: The bitwise operator that outputs the opposite of each input bit is the ___ operator
A: ~ (NOT)

Q: What do we use to apply boolean operations on the value of the operand(s)?
A: Logical operators

Q: Logical operators return the value 1 for ___
A: True
In C, anything other than 0 will return as True

Q: Logical operators return the value 0 for ___
A: False
In C, any value of 0 (including NULL and '\0') is False

Q: The logical operator that outputs a 1 if both inputs are non-zero is the ___ operator. Outputs a 0 otherwise.
A: && (AND)

Q: The logical operator that outputs a 1 if either input is non-zero is the ___ operator. Outputs a 0 otherwise.
A: || (OR)

Q: The logical operator that outputs a 1 if the input is 0 is the ___ operator. Outputs a 0 otherwise.
A: ! (NOT)

Q: Non-negative (i.e., counting up from 0) integers are known as ___
A: Unsigned integers

Q: For any given integer length (n bits), how many numbers can we represent?
A: 2^n (range: 0 to 2^n - 1)

Q: An even split of both positive and negative integer values are known as ___
A: Signed integers

Q: On modern computers, what is the accepted implementation for signed numbers called?
A: Two's Complement

Q: What is -x == ~x + 1 (“flip the bits and add one”)?
A: Two’s complement negation procedure