Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Bitwise Operations Convert the integers 57 and 123 into one byte binary and hex. Show your work. Call the resulting hex values a and b.
Bitwise Operations
- Convert the integers 57 and 123 into one byte binary and hex. Show your work. Call the resulting hex values a and b.
- Compute the values of these Python Expressions:
a | b a & b a ^ b
- Convert the results from Part 2 to hex and decimal. Show your work.
- Write a Python script to verify the calculations in parts 2 and 3. Use the Bitwise Example to help you.
- The file quiz-scores.bin in the zip file quiz-scores.zip contains records with three fields each:
Field Name Format Size first_name ASCII Code 8 bytes student_id Packed Decimal 4 digits representing decimal digits (2 bytes) quiz_answers Bit String 0 means F, 1 means T. 5 bits with 3 padding bits (1 byte) > py hexdump.py examp.bin 00000 41 6c 69 63 65 20 20 20 12 34 68 A l i c e ^R 4 h
You can also redirect the dump from the Command Prompt Window to an output text file like this:> py hexdump.py examp.bin > dump.txt
Here is the hex dump for quiz-scores.bin in case you have trouble running hexdump.rb and saving the output. Include this dump in your submission for Project 1. Here is the interpretation of the hex dump for Alice: Interpretation: Field 1 (first_name): 41 6c 69 63 65 20 20 20 8 bytes: ASCII codes for Alice padded with three spaces. Field 2 (student_id): 12 34 2 bytes: The student id 1234 which consists of 4 packed decimal digits. Field 3 (quiz_answers): 68 = 01101000 1 byte: 01101 represents the answers to a true/false quiz F,T,T,F,T, with 3 zero bits of padding.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started