Bits and Bytes Flashcards

1
Q

What is a byte?

A

It is a group of 8 bits that can be individually addressable.

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

What is a bit?

A

Holds 0 or 1

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

What is a word?

A

● It is a group of 4 bytes (32 bit architecture) or
● It is a group of 8 bytes (64 bit architectures)
● The address of a word is aligned to either 4 or 8 bytes respectively (multiple of 4 or 8 bytes).

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

What is memory mapped I/O?

A

When device registers are mapped to
memory.

A bit can represent the state of the device.

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

What are 3 examples of Character Encodings broken question

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

Who created Extended Binary Coded Decimal Interchange Format?

A

● It was created by IBM in the 1960s
● No longer in use except in some IBM
mainframes

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

What does ASCII stand for?

A

American Standard Code for Information
Exchange

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

How many bits/values does ASCII use?

A

It uses 7 bits or 128 values

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

What does ascii encode?

A

The English alphabet

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

How many bits does Unicode use?

A

16 bits (2 bytes)

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

What does unicode encode?

A

Languages from all around the world

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

What languages use unicode internally for strings?

A

Java and C#

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

How does Pascal represent strings?

A

The first byte is the length of the string

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

How do you perform math in binary? (Addition, Subtraction, Multiplication, Division)

A

Same as decimal, just with binary digits

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

What ways are Negative Binary numbers represented?

A

● Sign and Magnitude
● 1-complement
● 2-complement

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

How does Sign and Magnitude
Representation work?

What is the value of 10000101?

A

1 bit for sign, 1 means negative, rest of the bits for absolute value.

Value of 10000101 is -5. first one means negative

17
Q

How does 1-Complement work?

What is the value of 11111110

A

Negative numbers are obtained by inverting all bits.

11111110 is -1. invert all 00000001, neg of that

18
Q

How does 2-Complement work?

What is the value of 5 in binary for 2-Com?

A

Negative numbers are obtained by
subtracting 1 from the positive number and inverting the result.

11111011

19
Q

Why is 2-Complements widely used?

A

because the same piece of hardware used
for positive numbers can be used for negative numbers:

20
Q

How does right shift&raquo_space; change for signed vs unsigned ints?

A

if signed and the int is negative, 1s will be added, this is called “signed extension”

21
Q

What do bitwise operations |, &, ^, ~ all do?

A

bitwise or, and, xor, not on each bit

22
Q

How to check if bit x is set?

A

shift bit 1 x units to the left. Use & on shifted bit and comparing int.

Then take result and shift x right, if equal to 1 return true, found set bit

23
Q

How to set bit?

A

Use | with desired bit

24
Q

How does floating point representation work?

A

Store both the exponent and mantissa
ex” 1.101x2^-010

25
What are the two representations for real numbers?
Fixed point numbers and Floating Point Numbers:
26
How do fixed point numbers work for real numbers?
Fixed number of bits for both integer and mantissa. N.M – N bits for integer part and M bits for mantissa. Example: 16 bit real number N =8 bits, M = 8 bits Problem: Range of numbers is small. N=8 bits can represent therange -128 to +127 +127=01111111=+127 -128=~(10000000-1)=-~(01111111)=10000000=-128
27
How do floating point numbers work for real numbers?
The bits allocated for integer part and mantissa is variable. Example= N.M where N+M =16bits ● Decimal point moves. Improved range but complex
28
What is the most common Floating Point Representation standard?
IEEE-754 standard
29
What order is Little Endian?
Least significant byte of the integer is in the lowest memory location.
30
What order is Big Endian?
Most significant byte of the integer is in the lowest memory location
31
32
How can you test if Little Endian?
cast little int pointer to char, if value of char is int value then little endian.
33
What is the size of integers floats and pointers and doubles in 32 bit architecture?
4 bytes for everything but doubles are 8
34
what is the size of pointers in 64 bit architecture?
8 bytes
35
struct { char ch1; int r; char ch2; char * a; } x; What is the size of the above structure in 64 bit architecture
24 bytes