Advanced Binary, Hexadecimal, and Algorithmic Logic Study Guide
Binary Number System and Place Values
Fundamentals of Binary (Base 2): * The binary system is a base 2 numbering system, meaning it uses only two digits: and . * Place values are determined by powers of 2, starting from the right (): * * * * * * * *
Conversion Example (Binary to Decimal): * A student was tasked with converting a specific binary string to base 10. * The calculation mentioned involved adding specific place values: . * The sum of these values is .
8-Bit System Constraints and Statistics: * The largest possible number representable with 8 bits () is . * The smallest possible number representable with 8 bits () is . * The total number of unique values that can be represented in an 8-bit system is . * Performance Remark: In a recent assessment, the class achieved a "2096% correct" (likely meant as 100% or 96% based on speaker context) performance on binary questions.
Methods for Binary and Decimal Conversion
- The "Subtraction from the Left" Method (Decimal to Binary): * To convert a decimal number like to binary, one should start with the largest bit value that fits into the number and subtract systematically. * Step-by-Step for : 1. Check : . Place a . Subtract: . 2. Check : . Place a . Subtract: . 3. Check : . Place a . 4. Check : . Place a . Subtract: . 5. Check : . Place a . 6. Check : . Place a . Subtract: . 7. Check : . Place a . Subtract: . 8. Check : . Place a . Subtract: . * The final binary representation for is .
Hexadecimal (Base 16) Concepts and Calculations
Base Systems General Rule: * Any base requires distinct single-digit symbols ranging from to . * Base 3: Requires 3 numbers (, , ). * Base 10 (Decimal): Requires 10 numbers ( through ). * Base 16 (Hexadecimal): Requires 16 symbols ().
Hexadecimal Symbols and Values: * Since a single digit cannot be (two digits), letters are used: * * * * * *
Hexadecimal Place Values: * The values are based on powers of 16: * * *
Complex Hex Conversion Example (): * Calculate each position: * The position: * The position: (which is ) * The position: (which is ) * Combine the values: .
ASCII Encoding Standards
- ASCII is often used in tests to compare binary/decimal values to characters.
- Important Key Value: The character "A" is represented by the decimal value .
- This is easily remembered because is exactly one more than the binary bit value of .
Algorithmic Logic and "For Each" Loop Errors
Understanding "For Each" Loops: * The loop iterates through a list, assigning each element to a variable (e.g.,
name) one at a time. * A procedure with parametersnameListandtargetNamewas evaluated.The Logically Flawed Search Algorithm: * The Issue: The code used an
elsestatement within the loop that reset thefoundIndexto zero whenever the currentnamedid not match thetargetName. * Dry Run/Trace Analysis: 1. List:[Andrea, Ben, Chris]. Target:Ben. 2. First Iteration:Andreadoes not equalBen.foundIndexset to . 3. Second Iteration:BenequalsBen.foundIndexset to index . 4. Third Iteration:Chrisdoes not equalBen. Because of theelseblock, the algorithm resetsfoundIndexto . * Conclusion: The final return value is incorrect () even though the name was in the list. Theelseclause should not be present if the goal is to retain a match found earlier in the loop.
Ethics and Legal Issues in Computer Science
Unethical Software Usage: * Purchasing a single-user license for software and installing it on multiple computers (e.g., a school computer lab) is an unethical and illegal use of resources. * Historical Case Study: The speaker mentioned a school district that was sued for a significant sum of money in the 1980s or 90s for making illegal photocopies of textbooks rather than purchasing multiple copies. A disgruntled former teacher reported the violation to the textbook company.
Software Types: * FreeWare: Software that is truly free to use and distribute.
Digital Media: Credibility and Content Reliability
- Online Newspapers vs. Social Media: * The primary advantage of online newspapers over social media is credibility. * Social media often lacks fact-checking. Users (anecdotally referred to as the "crazy uncle" or "grandma") often post or share information from non-valid or non-credible sources without verification.
Procedure Case Study: Summer Camp Lunch List Logic
Problem Scenario: * A camp has a
morningListand anafternoonList. * Goal: Create alunchListcontaining only children who attend both sessions.Intersection Logic Implementation: * The procedure uses nested logic or a helper function called
isFound. * Iteration Process: 1. Iterate through every child in themorningList. 2. For each child, executeisFound(afternoonList, child). 3. IfisFoundreturnsTrue, add the child to thelunchList. * Example Trace: * ChildChloe(in Morning list) is checked against the Afternoon list. She is found, so she is added to the Lunch list. * ChildSean(in Morning list) is checked. He is not in the Afternoon list;isFoundreturnsFalse, and he is not added.
Questions & Discussion
- Question: Can we use the "flippy doo" (a binary tool) on the test? * Response: No, students cannot bring physical tools. However, if a student has it tattooed on their hand, they can (humorous asides).
- Question: What is a bad test case for the search code?
* Response: A case where the target name is not at the very end of the list, as the
elseblock will overwrite a correct find with a zero. - Question: Problem 67 on the practice test regarding ethics. * Response: The speaker clarified that illegal installation of single-user software is the correct unethical example.
- Question: Problem 31 regarding online newspapers. * Response: The speaker addressed the credibility advantage of news sites over social media.
- Performance Note: The previous year's class had a high average score of on the practice test.