Question
1. Interpretation of Data Types Consider the 32-bit string represented as the hexadecimal number x476F 6C66 What value does this number represent for each of
1. Interpretation of Data Types
Consider the 32-bit string represented as the hexadecimal number x476F 6C66
What value does this number represent for each of the following representations?
- Unsigned
- 2's complement
- IEEE 754 floating point
- Extended-ASCII string
2. Unsigned representation vs. 2's complement
Order the next two sequences of numbers in ascending order twice. First, assume that the numbers are written in 8-bit unsigned and then in 8-bit 2's complement representation. Remember the different notations for binary, decimal and hexadecimal numbers.
- 0111 1100, 0101 1010, xDD, xEA
- x71, x8B, 1001 0110, 0110 1001
3. Logical operations
Perform the following bitwise logical operations.
-
1000 0111 OR (NOT(0010 1001) AND 1001 1001)
- NOT((xC0 AND xFF) OR xEE)
4. Conversion to floating point data type
Convert the following decimal numbers into their 32-bit floating point representation (IEEE single precision). You may use a calculator to do the required multiplications, but you must show your work, not just the solution.
- -59.75
- 0.3
Hint 1: Not all numbers can be represented exactly using the floating point data type, so do not expect that you will always reach 0 after many multiplications.
Hint 2: A rule of thumb to know if you did your calculations correctly is to convert back to decimal representation to check your answer.
5. Conversion from floating point data type
Convert the following 32-bit floating point numbers (IEEE single precision) into their decimal representation.
-
0100 0000 0100 1001 0000 1110 0101 0110
-
1100 0101 0001 1111 1000 0000 0000 0000
6. Code transformation
Before a program written in C can be executed on a computer, what step is required to be done first? Briefly explain this step.
7. Basic I/O in C
Write a few lines of code that will accomplish the following:
- Ask the user to first enter his/her weight (in pounds) and second enter the age. For every field to be filled in, print on screen the messages "Type your weight: " and "Type your age: " respectively.
- Print on screen on different lines the collected information with a message "Your weight is " and "Your age is ".
For this problem, there is no need to write any #include preprocessor directives or main() function in the solution. Just write the C language instructions needed to accomplish the required task, but do not forget to declare the variables needed to store entered value.
8. Operators
What is the value each of the following C expressions evaluate to? Assume a and b have been initialized with 0x3794 and 0x8268, respectively. Write your answers as hexadecimal numbers.
- a | b
- a ^ b
- ~a
- a & b
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