Podcast
Questions and Answers
What symbols are used by modern computers?
What symbols are used by modern computers?
- A, B, C, D, E, F
- 0 and 1
- 0, 1, and 2 (correct)
- Any natural number
A group of 6 contiguous bits is called a byte.
A group of 6 contiguous bits is called a byte.
False (B)
What is a single '0' or '1' called in the context of computers?
What is a single '0' or '1' called in the context of computers?
bit
A group of 8 contiguous bits, treated as a unit, is called a ______.
A group of 8 contiguous bits, treated as a unit, is called a ______.
What is the 'bit model' used to represent strictly non-negative integers?
What is the 'bit model' used to represent strictly non-negative integers?
A 'nybble' is a group of 8 bits.
A 'nybble' is a group of 8 bits.
What is the name of the system used to write numbers where the position of a digit determines its value?
What is the name of the system used to write numbers where the position of a digit determines its value?
In the expression $3 \times 10^2 + 5 \times 10^1 + 7 \times 10^0$, the base is ______.
In the expression $3 \times 10^2 + 5 \times 10^1 + 7 \times 10^0$, the base is ______.
What is the decimal equivalent of the unsigned binary number 101010â‚‚?
What is the decimal equivalent of the unsigned binary number 101010â‚‚?
When converting decimal to binary using the algorithm described, you read the 'bit' column from top to bottom.
When converting decimal to binary using the algorithm described, you read the 'bit' column from top to bottom.
During the conversion of decimal to binary, what value is assigned to 'bit' if the 'value' is even?
During the conversion of decimal to binary, what value is assigned to 'bit' if the 'value' is even?
During decimal to binary conversion, the 'bit' is assigned a value of 1 if the 'value' is ______.
During decimal to binary conversion, the 'bit' is assigned a value of 1 if the 'value' is ______.
What is the binary representation of the decimal number 123?
What is the binary representation of the decimal number 123?
Hexadecimal representation uses base 8.
Hexadecimal representation uses base 8.
What prefix is used to identify hexadecimal values?
What prefix is used to identify hexadecimal values?
In hexadecimal representation, the symbol 'A' represents the decimal value ______.
In hexadecimal representation, the symbol 'A' represents the decimal value ______.
How many bits are needed to represent all possible values between 0 and 15?
How many bits are needed to represent all possible values between 0 and 15?
When converting binary to hexadecimal, you should start grouping bits from the MSB (left end).
When converting binary to hexadecimal, you should start grouping bits from the MSB (left end).
When converting binary to hexadecimal, what size should the groups of bits be?
When converting binary to hexadecimal, what size should the groups of bits be?
If the number of bits is not a multiple of 4, ______ with zeros is necessary when converting binary to hexadecimal.
If the number of bits is not a multiple of 4, ______ with zeros is necessary when converting binary to hexadecimal.
What is the hexadecimal representation of the binary number 1011 1010 1101?
What is the hexadecimal representation of the binary number 1011 1010 1101?
A 64-bit word limits the virtual address space to 4GB.
A 64-bit word limits the virtual address space to 4GB.
What is the nominal size of pointer data related to in the context of computer memory?
What is the nominal size of pointer data related to in the context of computer memory?
Every computer has a ______ size, which is the largest number of contiguous bits the ALU handles.
Every computer has a ______ size, which is the largest number of contiguous bits the ALU handles.
Which of the following data types typically occupies 2 bytes of memory?
Which of the following data types typically occupies 2 bytes of memory?
The C standard guarantees that all data types have fixed sizes across all implementations.
The C standard guarantees that all data types have fixed sizes across all implementations.
According to the C standard, what does the ISO C99 define to avoid vagaries of typical sizes?
According to the C standard, what does the ISO C99 define to avoid vagaries of typical sizes?
According to the content, all pointers are ______ bytes on 32-bit systems.
According to the content, all pointers are ______ bytes on 32-bit systems.
What format specifier in printf()
is used for hexadecimal output?
What format specifier in printf()
is used for hexadecimal output?
In C, the printf()
function is defined as part of the C language itself.
In C, the printf()
function is defined as part of the C language itself.
What does the %2d
format specifier in printf()
indicate?
What does the %2d
format specifier in printf()
indicate?
The format specifier ______ is used for a single character in C's printf()
function.
The format specifier ______ is used for a single character in C's printf()
function.
According to the slide, what is specified by addresses?
According to the slide, what is specified by addresses?
In a big-endian system, the least significant byte is stored at the lowest memory address.
In a big-endian system, the least significant byte is stored at the lowest memory address.
If variable x has a 4-byte value of 0x01234567 and its address is given by &x is 0x100, how is it stored in little endian?
If variable x has a 4-byte value of 0x01234567 and its address is given by &x is 0x100, how is it stored in little endian?
In a big-endian system, the most significant byte of a multi-byte value is stored at the ______ memory address.
In a big-endian system, the most significant byte of a multi-byte value is stored at the ______ memory address.
Match the following hexadecimal values with their decimal equivalents:
Match the following hexadecimal values with their decimal equivalents:
What is the result of the operation 0x503c + 0x40
(without converting to decimal)?
What is the result of the operation 0x503c + 0x40
(without converting to decimal)?
What is the range of values (in decimal) that can be represented by a single unsigned byte when written in hexadecimal?
What is the range of values (in decimal) that can be represented by a single unsigned byte when written in hexadecimal?
Given $n = 19$, which of the following represents $2^n$ in hexadecimal?
Given $n = 19$, which of the following represents $2^n$ in hexadecimal?
Compilers are guaranteed by the C standard to treat char
as signed.
Compilers are guaranteed by the C standard to treat char
as signed.
What is the decimal value of the largest unsigned integer that can be represented with 3 bits?
What is the decimal value of the largest unsigned integer that can be represented with 3 bits?
In the context of memory addresses, successive word addresses differ by 8 bytes for ______-bit systems.
In the context of memory addresses, successive word addresses differ by 8 bytes for ______-bit systems.
Assume that the address of a variable 'x', denoted as &x
, is 0x100
. Variable 'x' has the 4-byte value 0x0A0B0C0D
. If the system uses little endian representation, what is the value of the byte at memory address 0x102
?
Assume that the address of a variable 'x', denoted as &x
, is 0x100
. Variable 'x' has the 4-byte value 0x0A0B0C0D
. If the system uses little endian representation, what is the value of the byte at memory address 0x102
?
If a value is displayed as 0x80, what is the decimal value if it is treated as a signed 8-bit integer?
If a value is displayed as 0x80, what is the decimal value if it is treated as a signed 8-bit integer?
Flashcards
Bit
Bit
A single '0' or '1' in computing.
Byte
Byte
A group of 8 contiguous bits, treated as a unit.
Nybble
Nybble
A group of 4 bits.
Bit Model
Bit Model
Signup and view all the flashcards
Unsigned Binary
Unsigned Binary
Signup and view all the flashcards
Positional Representation
Positional Representation
Signup and view all the flashcards
Radix (Base)
Radix (Base)
Signup and view all the flashcards
Hexadecimal
Hexadecimal
Signup and view all the flashcards
Binary to Hex Conversion
Binary to Hex Conversion
Signup and view all the flashcards
Word Size
Word Size
Signup and view all the flashcards
Size of Pointer Data
Size of Pointer Data
Signup and view all the flashcards
C Standard Minimum Sizes
C Standard Minimum Sizes
Signup and view all the flashcards
Printf() Function
Printf() Function
Signup and view all the flashcards
Byte Addressing
Byte Addressing
Signup and view all the flashcards
Big Endian
Big Endian
Signup and view all the flashcards
Little Endian
Little Endian
Signup and view all the flashcards
Study Notes
- Modern computer hardware is based on binary digits, namely 0 and 1.
- Computer stores everything as numbers.
- The single symbols modern computers use are 0 and 1.
- A single 0 or 1 is a bit, which means binary digit.
- A group of 8 contiguous bits, treated as a unit is a Byte.
- A group of 4 bits is a Nybble.
- Bits are grouped, and methods are used for interpretation.
- Each method of interpretation is a bit model.
- The bit model for non-negative integers is unsigned binary.
- Examining the bit-models of C data types provides insight into memory usage.
- Numbers are written using a positional representation system.
- The decimal number 357 is represented as 3 x 10^2 + 5 x 10^1 + 7 x 10^0.
Numbers in Base r
- A number (dn-1dn-2...d1d0)r in base (or radix) r is expressed as dn-1 * r^(n-1) + dn-2 * r^(n-2) + ... + d1 * r^1 + d0 * r^0.
- (bn-1bn-2...b1b0)2 in base 2 or binary is expressed as bn-1 * 2^(n-1) + bn-2 * 2^(n-2) + ... + b1 * 2^1 + b0 * 2^0
- The unsigned binary number 1010102 equals 1 * 2^5 + 0 * 2^4 + 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 0 * 2^0 which is equal to 4210.
Conversion from Decimal to Binary
- Start with two columns: value and bit
- If the value is even, put a 0 in the bit column, and if odd, put a 1 in the bit column.
- Update the value column, by setting the new value to the old value divided by 2 and rounded down.
- The binary representation of the given value is the bit column read from bottom (MSB) to top (LSB).
- Given 123 represented as 12310, the bit column bottom->top gives 11110112
- Decimal numbers can be related to their bit patterns in binary.
Hexadecimal Representation
- Modern computers use 32 or 64-bit words and to overcome this, base 16 is used.
- Base 16 is hexadecimal (HEX) representation.
- Hexadecimal needs 16 symbols, identified as "higits" from 0 to 15.
- In HEX, symbols 0-9 are the same as in decimal.
- After that: 10 is A, 11 is B, 12 is C, 13 is D, 14 is E, and 15 is F.
- HEX values are identified with the prefix 0x, e.g., 0xF00D.
Converting Binary to Hex
- Group bits into sets of 4 starting from the right end (LSB).
- Pad the front with zeroes if necessary.
- Replace each group of 4 with the "higit".
Converting Hex to Binary
- Replace each "higit" with the group of 4 bits from the table.
Basic C Data Types
- Every computer as a word size.
- This is the largest number of contiguous bits that the ALU handles.
- It manifests as the nominal size of pointer data i.e. the number of bits required for a virtual address.
- A 32-bit word limits virtual address space to 4GB, while a 64-bit word allows 16 Exabytes.
- Given the signed data types [signed] char, short, int, long, int32_t, int64_t, char *, float and double
- The corresponding unsigned data types are unsigned char, unsigned short, unsigned int, unsigned long, unit_32, unit_64
- And respective byte allocations 1, 2, 4, 4/8, 4, 8, 8, 4, 8.
- Allocated sizes may vary but are typically as shown in the table.
- ISO C99 defines int32_t and int64_t which are guaranteed 4 & 8 bytes, respectively.
- C standard only guarantees minimum sizes and the actutal size is implementation dependant.
- intN_t is guaranteed for N = 8, 16, 32, 64.
- All pointers are 8 bytes (4 bytes for 32 bit systems).
- Compilers typically treat char as signed, though it is not guaranteed in the C standard unless the prefix signed is used.
- The C standard only guarantees lower bounds, except for intN_t types.
- Printf() is a general purpose output formatting function.
- Printf is not defined in C, and is part of the standard library of functions (stdio.h)
- The first argument is a string of chars to be printed, with each % indicating a substituted argument.
- For instance: printf("%2d\t%f\t%4.2f", dayNum, temperature, cost) DayNum is an integer at least 2 digits wide (%2d). Temperature is a floating point. Cost will print as floating point, at least 4 characters wide, 2 after the decimal point.
- Other format specifiers: u unsigned, x/X (int) hex, c single char, f/g/G floating point, p pointer (void *).
Multi-Byte Data and Addressing
- Programs use addresses to refer to data.
- Data is conceptually in a large array of bytes.
- An address is like an index into that array, and the pointer variable stores an address.
- Systems give each process private address spaces.
- Addresses specify byte locations, as such the address is of the first byte in the word.
- Successive word addresses differ by 8 bytes (for 64-bit) and
Endianness
- A variable x has a 4-byte value 0x01234567, and the address given by &x is 0x100.
- In big endian, the bytes are stored in memory as 01 23 45 67.
- In little endian, the bytes are stored in memory as 67 45 23 01.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Explanation of binary digits, bits, bytes, and nybbles in computer hardware. Discussion of bit models, positional representation systems, and base r numbers, with examples of decimal and binary representations.