Podcast
Questions and Answers
What is the basic unit of information in modern computing?
What is the basic unit of information in modern computing?
- Bit (correct)
- Word
- Paragraph
- Byte
Bits are commonly accessed individually in memory.
Bits are commonly accessed individually in memory.
False (B)
What is a byte?
What is a byte?
the standard smallest package of bits
A _____ is the unit of information accessed by a CPU.
A _____ is the unit of information accessed by a CPU.
Match the following data sizes with their typical sizes:
Match the following data sizes with their typical sizes:
What is the primary advantage of hexadecimal notation?
What is the primary advantage of hexadecimal notation?
Octal (base 8) is widely used in modern computing due to its efficient representation of bytes.
Octal (base 8) is widely used in modern computing due to its efficient representation of bytes.
How many bits does each digit in hexadecimal represent?
How many bits does each digit in hexadecimal represent?
To indicate that a number is in hexadecimal format, it is often prefixed with _____.
To indicate that a number is in hexadecimal format, it is often prefixed with _____.
Match the following base number systems with their representation:
Match the following base number systems with their representation:
What does addressing refer to in the context of memory?
What does addressing refer to in the context of memory?
In a big-endian system, bytes are ordered from least significant to most significant.
In a big-endian system, bytes are ordered from least significant to most significant.
Define byte ordering.
Define byte ordering.
In a _____ endian system, bytes are ordered from least significant to most significant.
In a _____ endian system, bytes are ordered from least significant to most significant.
Indicate whether the following are examples of Little Endian or Big Endian:
Indicate whether the following are examples of Little Endian or Big Endian:
What is a common characteristic of strings in memory?
What is a common characteristic of strings in memory?
Unicode encoding always uses one byte per character.
Unicode encoding always uses one byte per character.
How many bytes does the string 'hello' take up in memory if it is nul-terminated and uses ASCII encoding?
How many bytes does the string 'hello' take up in memory if it is nul-terminated and uses ASCII encoding?
The encoding standard commonly used in C which represents each character as a single byte is known as _____.
The encoding standard commonly used in C which represents each character as a single byte is known as _____.
Match the following string encoding standards with their properties:
Match the following string encoding standards with their properties:
What is the fundamental unit of data that can be manipulated using bitwise operations?
What is the fundamental unit of data that can be manipulated using bitwise operations?
In C, a byte is denoted by the int
type.
In C, a byte is denoted by the int
type.
If x = 0xD5
(11010101 in binary) and y = 0x5D
(01011101 in binary), what is the result of x & y
in binary?
If x = 0xD5
(11010101 in binary) and y = 0x5D
(01011101 in binary), what is the result of x & y
in binary?
If x = 0xD5
(11010101 in binary) and y = 0x5D
(01011101 in binary), the result of x | y
is _____ in binary.
If x = 0xD5
(11010101 in binary) and y = 0x5D
(01011101 in binary), the result of x | y
is _____ in binary.
Match the given Assembly instruction with its explaination
Match the given Assembly instruction with its explaination
What is the purpose of the following C code? return (b >> i) & 1;
What is the purpose of the following C code? return (b >> i) & 1;
Bytes are uniquely addressable in memory!
Bytes are uniquely addressable in memory!
What is the purpose of bitwise operators?
What is the purpose of bitwise operators?
A string of _____ characters takes n+1 bytes to store
A string of _____ characters takes n+1 bytes to store
Match number system with its base
Match number system with its base
Which task is NOT typically a reason to care about byte ordering?
Which task is NOT typically a reason to care about byte ordering?
A single bit does store enough useful information on its own.
A single bit does store enough useful information on its own.
What is null terminated string?
What is null terminated string?
A _____ is 16-bytes (128-bits) in size (typically)
A _____ is 16-bytes (128-bits) in size (typically)
Match the bitwise operator with its function:
Match the bitwise operator with its function:
If w = 0xff
, what is !w
?
If w = 0xff
, what is !w
?
Multiplying a number by 8 in Octal adds a digit zero to its value at the end.
Multiplying a number by 8 in Octal adds a digit zero to its value at the end.
Explain what is hexadecimal number system in short.
Explain what is hexadecimal number system in short.
The memory of computer is a large collection of elements, each of which stores one _____ of infomation
The memory of computer is a large collection of elements, each of which stores one _____ of infomation
What is the result of 1048576 (base 10) = ? (base 4)
?
What is the result of 1048576 (base 10) = ? (base 4)
?
Flashcards
What is a bit?
What is a bit?
The basic unit of information in modern computing, storing two different values (0 or 1).
What is a byte?
What is a byte?
The 'standard' smallest package of bits, typically containing 8 bits.
What is a word?
What is a word?
Unit of information accessed by a CPU, with size depending on the CPU.
What is a paragraph?
What is a paragraph?
Signup and view all the flashcards
What is a page?
What is a page?
Signup and view all the flashcards
What is hexadecimal?
What is hexadecimal?
Signup and view all the flashcards
What is addressing?
What is addressing?
Signup and view all the flashcards
What is byte ordering?
What is byte ordering?
Signup and view all the flashcards
What is Big Endian?
What is Big Endian?
Signup and view all the flashcards
What is Little Endian?
What is Little Endian?
Signup and view all the flashcards
What are strings?
What are strings?
Signup and view all the flashcards
What is Machine code?
What is Machine code?
Signup and view all the flashcards
What are Bitwise Operators?
What are Bitwise Operators?
Signup and view all the flashcards
What are Logical Operators?
What are Logical Operators?
Signup and view all the flashcards
Study Notes
Bits and Bytes
- The bit is the fundamental unit of information; it can store two values: 0 (no electric current) and 1 (electric current).
- Computer memory is a collection of elements, each storing one bit.
- Bits are typically accessed in packages of bytes, words, paragraphs, or pages because single bits are too small to be useful to access by themselves.
- A byte is considered the smallest standard package of bits.
- Today, a byte contains 8 bits, but in the past, bytes ranged from 6-9 bits.
- Bytes are uniquely addressable in memory.
- A word is the unit of information accessed by a CPU, typically 8, 16, 32, 64, or 128 bits.
- A word is the amount of information that can be transferred between the CPU and main memory in one go.
- A paragraph is usually 16 bytes (128 bits).
- A page is typically 4KB (4096 bytes) or 8KB (8192 bytes) depending on the hardware and system.
- A page is the amount of information transferred between main memory and secondary storage.
- Programming languages can access information at the byte level, which contains a unique address in physical memory.
Hexadecimal Notation
- Bits, bytes, words, and paragraphs are all powers of 2.
- Computations often involve multiplying and dividing by 2.
- Multiplying or dividing by 2 easier in binary (adding/removing a 0).
- Octal (base 8) requires 3 digits to represent a byte, but the most significant octal digit is not fully used.
- Hexadecimal (base 16) provides a solution since the number of bits per digit divides nicely into 8 (4 bits per digit).
- Doing everything in hex avoids conversion mistakes and uses fewer digits.
- To convert decimal to hex, repeatedly divide the decimal value by 16. The remainders form digits in the hex representation. (e.g., 23512 (decimal) == 5BD8 (hex)).
- To convert hex to decimal, multiply each hex digit by increasing powers of 16 and add the results (e.g. 5BD8 (hex) == 23512 (decimal)).
- Use the prefix 0x to indicate a value is in hex.
Addressing and Byte Ordering
- Addressing shows how data is located in memory.
- Each byte has a unique address in increasing order, in a relatively standard manner.
- A piece of data in memory consists of one or more bytes, and its address is the address of the first byte.
- Byte ordering refers to the order of bytes in a piece of data.
- The order of bytes for strings depends on the data itself.
- There are two byte orders for numerical data types, such as integers and floating-point numbers.
- Big Endian orders bytes from most significant to least significant.
- Little Endian orders bytes from least significant to most significant.
- Byte ordering depends on the hardware, or CPU.
- Applications for reading and writing binary data to files and receiving and transferring binary data over networks may depend on byte order. Exchanging data between computer architectures and debugging tasks can rely on byte ordering.
Strings and Encoding
- Strings are stored as sequences of bytes in memory and are often null-terminated (end with a 0).
- A string of n characters takes n+1 bytes to store because of the null terminator.
- Strings are commonly encoded in ASCII (1 byte per character) or Unicode (often 2 bytes per character).
- The American Standard Code for Information Interchange (ASCII) typically uses a single byte for all characters, and cannot encode non-English characters or special characters.
- Unicode is able to encode characters from many languages (UTF-16 uses two bytes per character, UTF-8 for English characters).
Machine Code
- Program instructions are stored as sequences of one or more bytes.
- The CPU moves a pointer in memory as it executes program instructions.
Bitwise and Logical Operations
- Individual bits cannot be addressed directly in programs.
- Bytes or words can be used to find bits.
- In C, a byte is the "char" type, and a word is the "int" type.
test(unsigned char b, int i)
right shifts achar
, (byte),b
, byi
and performs a bitwise AND with 1 to get the value of bit i.- Bitwise operators work on the bits of values, and logical operators test entire values.
Bitwise Operator Summary:
~
Negates all bits (~x
).&
Bitwise AND:x & y
.|
Bitwise OR:x | y
.^
Bitwise XOR:x ^ y
.>>
Right shift:x >> 3
(shifts bits 3 places to the right).<<
Left shift:x << 3
(shifts bits 3 places to the left).
Logical Operator Summary:
!
Negates a value:!x
(0 if x is non-zero, 1 if x is zero).&&
Logical AND:x && y
(1 if both x and y are non-zero, else 0).||
Logical OR: Example:x || y
(1 if either x or y is non-zero, else 0).
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Explanation of bits, bytes, words, paragraphs and pages. The bit is the fundamental unit of information; it can store two values: 0 and 1. Computer memory is a collection of elements, each storing one bit. A byte is the smallest standard package of bits.