Ask Programming Language Expert

? Along with your name, include your student ID# and discussion section at the top of your Assignment.

? There are eight problems; we will go over them in dicussion section after the due date.

? The textbook in this context is: R. Bryant, D. O'Hallaron, Computer Systems: A Programmer's Perspective. (3rd Edition)

Problem 1.

Q1. Give the base 10 integer equivalent of the following. Assume 16 bit hex numbers, 16 bit, twos complement.

a) 0xC87A

b) 0x1BCD

Q2. Write a mask (in hexadecimal) to give the value of the last 9 binary digits of the numbers in Q1 above.

Q3: Using your mask from Q2 above, give the equivalent base 10 values represented by the last 9 binary digits for both hexadecimal values from Q1.

Problem 2.

Assume you trying to reconstruct a sequence of 12 bits (call it 'a') where the middle four bits are missing. What you have is the hexadecimal sequence E_E where "_" represents the missing bits. You also have the octal bit sequence representing bitwise NOT(a)which is "_52_". There are two missing digits in this sequence (represented by the '_').

Q1. What is the complete hexadecimal value of a?

Q2. What is the base 10 equivalent of the complete value of a?

Problem 3.

Suppose you are given a positive integer number ‘x'. Give a single expression (using only bitwise operators, shifts, +, -) to find the value of 4.5 * x.

Problem 4. (similar to Problem 2.88 in the text)

Consider the following two 9-bit floating point representations based on IEEE floating point format.

Format A

? There is 1 sign bit.

? There are k = 5 exponent bits. The exponent bias is 15.

? There are n = 3 fraction bits.

Format B

? There is 1 sign bit.

? There are k = 4 exponent bits. The exponent bias is 7.

? There are n = 4 fraction bits.

In the table below, given the bit patterns in Format A , convert to the closest value in Format B and fill in the bit pattern in the "Bits" column under Format B. If rounding is necessary, you should round toward +∞. For both Format A and Format B, fill in the base 10 equivalent values. The first bit sequence is completed for you.

Format A Format B

Bits Value Bits Value

1 01111 001 -9/8 1 0111 0010 -9/8

1 10110 111

0 01101 100

1 00000 100

0 00000 000

0 11000 101

Problem 5.

Assume you have a 16 bit machine with 65536 bytes of memory. Ints are 2 bytes. Assume that variables are placed in memory contiguously in the order they are coded, starting at memory address 0x500. That means that ints and memory addresses are 16 bits long. Given the following code segment:

int x = 4; int y = 3;

int *px = &x; int *py = &y;

printf("starting x) %d\n", x); printf("starting y) %d\n", y); printf("a) %p\n", px); printf("b) %p\n", py);

py = px;

printf("c) %d\n", *px); printf("d) %x\n", &px); *px = 35; y = 120; printf("e) %d\n", *px); printf("f) %d\n", *py); printf("g) %d\n", x); printf("h) %d\n", y);

Give the output of each printf() assuming the %p format specifier prints out a memory address in hexadecimal.

Problem 6. Assume 8-bit twos complement integer representation for the questions that follow:

Q1: Give the bit sequence for the largest positive number.

Q2: Give the base 10 integer equivalent value for the bit sequence in Q1 above.

Q3: Add: 10110110 + 01110111

What is the resulting bit sequence?

What is the corresponding base 10 value?

Does this computation result in an overflow? Briefly explain.

Q4: Add: 01110111 + 01001111

What is the resulting bit sequence?

What is the corresponding base 10 value?

Does this computation result in an overflow? Briefly explain.

Q5: Add: 10111111 + 11111111

What is the resulting bit sequence?

What is the corresponding base 10 value?

Does this computation result in an overflow? Briefly explain.

Problem 7. (taken from the text Question 2.86 page 137)

Intel processors support "extended precision" floating point format with 80 bits that includes a single "integer bit" representing the hidden or implied leading 1 in the IEEE representation. The integer bit is "1" for normalized values (indicating a 1 immediately to the left of the binary point, and it is "0" for non-normalized values. Using a highly abbreviated (8-bit) version of this format with 1 sign bit, 4 exponent bits, the single integer bit, and 2 fraction bits, give the bit representations for the floating point numbers requested below.

Q1: 0.0

Q2: -1.0

Q3: 1/16

Q4: 1.25

Q5: 2.0

Problem 8.

For each of the following propositions in the context of a C program, indicate if they are true or false. If false, give a counter example. Assume that the variables are declared as follows:

int x, y; // 32 bit integers

unsigned u; // 32 bit unsigned integer

and initialized to some unknown values. We have given the first answer as an example.

TRUE/FALSE Counter Example

01..1 + 1 → 10..0 which
If x > 0 then x + 1 > 0 FALSE
is negative

If x < 0 then x -1 < 0

If x > 0 then x * x > 0

(~u <= 0) == FALSE

If x < 0 then u > x

If x > -y then -x < y

(x << m) >> m == x

u & 0 == 0

If x >= 0 then ~x <= -x - 1

Attachment:- Assignment.rar

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92080047
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in Programming Language

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As