Question: 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:
Use the hex dump utility to interpret the data in quiz-scores.bin. Here is a sample hex dump and interpretation of one record: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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
