Question
Homework 1 Representing and Manipulating Information (1) Important Requirements When asked to explain your answer in few words or show your work, please provide your
Homework 1 Representing and Manipulating Information (1) Important Requirements When asked to explain your answer in few words or show your work, please provide your explanation and/or calculation to receive full points. To help graders grade your submission and not risk losing points: Please number your answers, or even better, use the same questions template in this document. Answers must be clearly separated from the questions (e.g., Bold questions, don't bold answers) You may perform ONLY the calculations by hand (not the code part) instead of typing, however, if you decide to do so, your handwriting MUST be very clear and should be scanned and attached to your pdf submission. Submit a pdf (filename format: HomeworkXX_lastname.pdf) to Canvas. (No ZIP or doc files accepted) A) (6 Points) Assume a 64-bit architecture as the underlying architecture for running a C program. Compute the hexadecimal value stored in the variable var after computing each of the following. To receive credit, explain all your work step by step, and perform the calculations according to the word sizes mentioned in each question (i.e., if the word size w is 32, show all your work/calculations as a 32-bit word). You may use binary values (0,1) for intermediate steps but your final answer should be in hexadecimal. 1) The twos complement of the hex value 0x1C stored in a variable var which is of type int in C. 2) Sign extending a byte/char represented by the hexadecimal value 0x8F stored in a variable var of type long in C. 3) The additive inverse of the decimal number 30 stored in a variable var which is of type short in C. B) (4 Points) By merely using one or more bit-level or bitwise operations you learned in class, write a C expression that results in a word consisting of the least significant byte of x and the remaining bytes of y. For instance, if x = 0xABCDEF10 and y = 0x23456789, the result should be 0x23456710. Explain your answer in few words. Hint: you can use bit masking to solve this problem. Bit masking involves applying bitwise operations to a word in order to select certain bits/bytes or eliminate/clear certain bits/bytes in that wor
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