Chapter 2: Bits, Data Types, and Operations Flashcards

1
Q

Presence of voltage is represented as _____ and absence of voltage as _____.

A

“1” and “0” (each 0 and 1 is a “bit”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

“bit” is short for ______.

A

binary digit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If we are limited to 8 bits, we can differentiate at most _______ different values.

A

256 (i.e. 2^8)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In general, with k bits, we can distinguish at most _____ distinct items.

A

2^k

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

unsigned integer

A

(positive only) a data type with many uses in a computer, such as: counting, and identifying different memory locations in the computer (i.e. like an address).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

signed integers

A

negative and positive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In binary representation, all positive integers have a leading ______.

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In binary representation, all negative integers have a leading ______.

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Three possible representations of signed integers:

A

signed magnitude, 1’s complement, 2’s complement (used on almost every computer manufactured today)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In 2’s complement representation, the choice of representation for negative integers is based on ______.

A

the wish to keep the logic circuits as simple as possible.

i. e. with ALU, the result of adding a negative and positive integer of the magnitude will always be 0.
(i. e. since 00101 is +5, 11011 is chosen for -5).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Basic mechanism to do addition used by almost all computers:

A

arithmetic and logic unit (ALU); has 2 inputs and 1 output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

T/F: The carry can always be ignored when dealing with 2’s complement arithmetic

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If we have A and want to find -A, do the following:

A

1) Find the complement of A by flipping all of the bits

2) then add 1 (00001) to the complement of A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Binary to Decimal conversion (8-bits):

A

bits are: a7 to a0
1) If a7 is 0 then the integer is positive, and we can evaluate magnitude; if a7 is 1, then negative and need to first find 2’s complement of the positive number with the same magnitude.
2) Magnitude is: a6 · 2^6 + … + a0 · 2^0
simply add the powers of 2 that have a coefficient of 1.
3) if original number was negative, affix minus sign in front

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Decimal to Binary conversion (8 bits):

A

given a decimal integer value N,
1) find the binary representation of the magnitude of N by forming the equation: N = a6 · 2^6 + … + a0 · 2^0.
Repeat the following until the left side of the equation is 0, each iteration will produce the value of one coefficient a:
a) Subtract the rightmost digit from both sides of the equation (1 if N is odd, 0 if N is even)
b) divide both sides of the equation by 2

2) if the original number N is positive, append a leading 0 sign bit
3) if the original number N is negative, append a leading 0 sign bit, then form the negative of this 2’s complement representation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A positive binary digit is odd if _____________ and even if ______________.

A

odd if: the rightmost digit is 1

even if: the rightmost digit is 0

17
Q

Adding a number to itself (provided there are enough bits to represent the result) is equivalent to…

A

…shifting the representation one bit position to the left.
i.e. 59 + 59 is 00111011 + 00111011 = 01110110

18
Q

T/F: In the same way that leading 0s do not affect the value of a positive number, leading 1s do not affect the value of a negative number.

19
Q

In order to add representations of different lengths, it is first necessary to _______________________. Which is referred to as ______________.

A

represent them with the same number of bits
i.e. 000001101 + 111011 should be written as 000001101 + 111111011
referred to as: Sign-EXTension (SEXT)

20
Q

Overflow

A

a carry out of the leading digit.
i.e. if adding two positive numbers causes overflow, the result will have a leading 1 as the sign bit
if adding two negative numbers causes overflow, the result will have a leading 0 as the sign bit

21
Q

T/F: Overflow - the sum of a negative number and a positive number never presents a problem

A

True
Because their sum will be a number which if positive, will have a lower magnitude (less positive) than the original positive number (because a negative number is being added to it), and vice versa.

22
Q

A logical variable can have one of two values:

A

0 (false) or 1 (true)

23
Q

Bit mask

A

a binary pattern that enables the bits to be separated into 2 parts (the part you care about and the part you want to ignore)
i.e. the bit mask 00000011 ANDed with any 8-bit pattern will be 00000000, 00000001, 00000010, or 00000011
this highlights the 2 right-most bits that are relevant.

24
Q

Binary logical functions

A

Requires 2 source operands
AND
OR
XOR (exclusive-OR :D )

25
Unary logical functions
Operates on only 1 source operand | NOT (complement operation: output is formed by complementing (inverting) the input)
26
XOR
Exclusive OR output is 1 if the two source operands are different 0 if the sources are the same ``` Truth Table 0 XOR 0 : 0 0 XOR 1 : 1 1 XOR 0 : 1 1 XOR 1 : 0 ```
27
How to determine if 2 patterns are identical:
If the output of the XOR is all 0s | because the XOR function produces a 0 only if the corresponding pair of bits is identical
28
Bit Vector
complex system made up of "busy" (0) and "available" (1) units
29
Floating Point Data Type
Allocates some bits to the range of values, and the rest for precision (except for the sign bit).
30
ASCII
8-bit code for transferring character code between main CPU and the input (i.e. keyboard) and output (i.e. monitor) devices. American Standard Code for Information Interchange
31
Hexadecimal Notation
base 16 Useful for dealing with long strings of binary digits without making errors. Mainly just used as a convenience for humans for fewer copying errors. Reduces the number of digits by a factor of 4.