- Published on
KembaraXtra-Computer Science- Bits and Bytes
Key Definitions
Key Definitions
- Digit: A single symbol in a decimal number (base-10).
- Bit (Binary Digit): A single symbol in a binary number (base-2). It can be either 0 or 1.
- Byte: A group of 8 bits.
- Nibble: A group of 4 bits (half a byte).
- A single bit can represent two states: 0 or 1 (off or on).
- To represent more complex information, bits are combined into sequences.
- Computers group bits into bytes (8 bits) for easier management.
- 4-bit Number: Can represent 16 unique combinations (from 0000 to 1111). Decimal values range from 0 to 15.
- Byte (8-bit): Can represent 256 unique combinations.
- Formula: The number of unique combinations for n bits is 2n.
- Example: 24 = 16, 28 = 256
- Computer engineers need to consider how many bits or bytes will be needed for storage of data.
- Example: A game with 12 levels can store the level number in 4 bits, but a game with 99 levels needs a byte.
- Published on
KembaraXtra-Computer Science-Number Systems
1. Introduction
1. Introduction
- Computers are digital machines that operate using 0s and 1s.
- Understanding number systems is essential to understanding how computers work with numbers.
- The number system humans commonly use.
- Uses ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
- Employs place-value notation
- Each position in a number represents a different power of 10 (base 10).
- Example: 275
- 5 is in the ones place (10⁰ = 1), so its value is 5 * 1 = 5.
- 7 is in the tens place (10¹ = 10), so its value is 7 * 10 = 70.
- 2 is in the hundreds place (10² = 100), so its value is 2 * 100 = 200.
- Total value: 5 + 70 + 200 = 275.
- Each place is a power of 10.
- Rightmost place: 10⁰ = 1 (ones place)
- Next place: 10¹ = 10 (tens place)
- Next place: 10² = 100 (hundreds place)
- And so on (10³ = 1000, etc.)
- Decimal uses ten symbols (0-9) because each place can represent ten different values.
- Any ten unique symbols could be used, but 0-9 is the convention.
- The number system used by computers (two symbols)
- Uses only two symbols: 0 and 1.
- Still a place-value system, but each place represents a power of 2.
- Each position is a power of 2 (base 2).
- Example: 101 (binary) which equals 5 (decimal)
- Rightmost place: 2⁰ = 1
- Next place: 2¹ = 2
- Next place: 2² = 4
- Total value: (1 * 1) + (0 * 2) + (1 * 4) = 1 + 0 + 4 = 5
- Multiply the symbol in each place by the place-value weight (power of 2) and sum the results.
- Find the largest power of 2 that is less than or equal to the decimal number.
- Subtract that power of 2 from the decimal number and repeat the process with the remainder.
- Put a 1 in the places corresponding to the powers of 2 that were used and a 0 in the other places.
- To avoid confusion, binary numbers are often written with a 0b prefix (e.g., 0b10 represents 2 in binary).
- Numbers without a prefix are assumed to be decimal.
- Published on
- Published on
KembaraXtra – Computer Terms – &
The ampersand symbol has multiple uses in computing. In UNIX systems, it is placed at the end of a command to run that command in the background, which allows the terminal to stay active for other tasks while the process continues. For root or system-level users, this symbol is also used to start special background services called daemons that stay running even after the user logs out. In web development, particularly in HTML or SGML, the ampersand is used to indicate special character codes or entities—like < to display a less-than sign. In spreadsheet applications, the ampersand serves as a function for connecting or joining text from different cells into one.
The ampersand symbol has multiple uses in computing. In UNIX systems, it is placed at the end of a command to run that command in the background, which allows the terminal to stay active for other tasks while the process continues. For root or system-level users, this symbol is also used to start special background services called daemons that stay running even after the user logs out. In web development, particularly in HTML or SGML, the ampersand is used to indicate special character codes or entities—like < to display a less-than sign. In spreadsheet applications, the ampersand serves as a function for connecting or joining text from different cells into one.
- Published on
KembaraXtra – Computer Terms – * :
The asterisk, also called the star symbol, is widely used in various computing environments. In programming, it often means multiplication. For example, 5 * 3 equals 15. In operating systems like Windows and MS-DOS, it works as a wildcard character to replace one or more characters in a filename. For instance, *.txt would refer to all text files. In C and C++ programming, the asterisk is also used for pointer operations—it helps retrieve the actual value stored at a memory location pointed to by a pointer variable.
The asterisk, also called the star symbol, is widely used in various computing environments. In programming, it often means multiplication. For example, 5 * 3 equals 15. In operating systems like Windows and MS-DOS, it works as a wildcard character to replace one or more characters in a filename. For instance, *.txt would refer to all text files. In C and C++ programming, the asterisk is also used for pointer operations—it helps retrieve the actual value stored at a memory location pointed to by a pointer variable.
- Published on
KembaraXtra – Computer Terms – . means:
This symbol combination is a wildcard pattern used mainly in command-line environments like MS-DOS and Windows. It represents every possible file name and every possible extension. For example, *.* could be used to copy, move, or delete all files in a directory, regardless of their names or file types. It is especially useful when performing actions on many files at once.
This symbol combination is a wildcard pattern used mainly in command-line environments like MS-DOS and Windows. It represents every possible file name and every possible extension. For example, *.* could be used to copy, move, or delete all files in a directory, regardless of their names or file types. It is especially useful when performing actions on many files at once.
- Published on
KembaraXtra – Computer Terms – .. means:
Two dots used together in file system navigation refer to the parent directory—the folder above the current one in the directory structure. This is a common shorthand used in UNIX and MS-DOS. A single dot (.) refers to the current directory. Together, .. is essential for moving up levels in command-line interfaces.
Two dots used together in file system navigation refer to the parent directory—the folder above the current one in the directory structure. This is a common shorthand used in UNIX and MS-DOS. A single dot (.) refers to the current directory. Together, .. is essential for moving up levels in command-line interfaces.
- Published on
- Published on
- Published on
KembaraXtra-Case Law-C and Python: High-Level Programming
I. Introduction
I. Introduction
- The best way to learn high-level programming is by examining programming languages and writing programs.
- This study guide focuses on C and Python.
- Both are powerful and useful languages that illustrate common programming functionalities with different approaches.
- History: Dates back to the early 1970s; initially used to write Unix OS.
- Level: High-level, but relatively close to machine code.
- Strengths:
- Good for operating system development and hardware interfacing.
- High-performance applications (e.g., games).
- Useful for educational purposes to show the mapping between low-level and high-level concepts.
- Weaknesses:
- Complex.
- Few safeguards against programmer errors.
- Related Language: C++ (developed in the 1980s) is an updated version of C.
- History: Initially released in the 1990s.
- Level: High-level, further removed from hardware than C.
- Strengths:
- Easy to read and simple for beginners.
- Suitable for complex software projects.
- "Batteries included" philosophy: Includes a comprehensive standard library.
- Good for teaching programming concepts.
- High-level languages provide abstractions of CPU instructions.
- CPUs provide instructions for:
- Memory access
- Math and logic operations
- Control of program flow
- The goal is to familiarize yourself with common programming ideas, not to become proficient in a specific language.