What is the corresponding base ten value

Assignment Help Programming Languages
Reference no: EM131325449

? 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

Reference no: EM131325449

Questions Cloud

Influence the attitudes and behaviors of employees : Choose two organizations that you feel have different organizational cultures - Explain how these organizations' cultures influence the attitudes and behaviors of employees.
What makes communication dynamic : What makes communication dynamic? What is a consequence of too much cohesion in a group
Find the premium on an at the money paylater call option : Find the premium on an at-the-money paylater call option. Then determine the market value of the option nine months later if the stock is at 110.
Type of classes of infections : What type of classes of infections may yeast and molds cause?
What is the corresponding base ten value : What is the resulting bit sequence? What is the corresponding base 10 value? Does this computation result in an overflow? Briefly explain. What is the complete hexadecimal value of a?
Template and newly synthesized strands : Do you expect to find more H2A or more H3 histone molecules in a chromatin? Explain your answer. 4. Draw a DNA replication process in a eukaryotic cell. On your drawing, label:
Determine a fair price for two year assetor nothing option : Determine a fair price for a two-year assetor-nothing option with exercise price of 120.- calculate your profit if the asset price at expiration is (1) 138 and (2) 114.
Summarize the christian worldviews response : Briefly summarize the Christian worldviews response to the problem of evil and suffering. Cite and reference the lecture and/or Chapter 9 in the textbook.
What about the charges at your doctors or dentists office : Are you among those who believe that hospital bills are excessive?What about the charges at your doctor's or dentist's office?Describe an experience with a bill that you received at a hospital or doctor's office.Should the government intervene to con..

Reviews

Write a Review

Programming Languages Questions & Answers

  Discuss the concept of reusability

Designing for Reusability- Discuss the concept of reusability and how to design for reusability. Provide an example with your posting

  Define and create an exception

Quotient throws an exception to the higher-level function main to decide whether or not the program should be terminated. Main catches the divByZero and prints out an appropriate comment on the screen. Also include in main a try block to catch the..

  Write a program to read student data from standard input

Write a program to read student data from standard input, sort it by last name / first name, and print result to standard output.

  Write a c api program under mysql to solve database query

In earlier assignment, we created a database with the following three relation schemes, where the data type for the attributes s and p is Varchar(10) under the SQL-standard, the data type of the attribute c is Char(6) and the attribute sec is of type..

  Software system to manage records of patients

A software system is to be developed to manage the records of patients who enter a clinic for treatment. The records include records of the all regular patient monitoring.

  Write script which declares and sets variable

Write the script which declares and sets a variable that's equal to total outstanding balance due. If that balance is greater than $10,000.00, the script must return the result set consisting of VendorName,

  Evaluate the fibonacci series

Write a program to evaluate the first 20 numbers of Fibonacci series.

  Discuss the features of object oriented programming language

Discuss the features of object oriented programming languages. A perfect square is a number that can be expressed as the product of two equal integers. Draw a flowchart, and write a corresponding class oriented program to check if any entered numbe..

  Program to execute on cse unix environment

Your program should be written in C++, execute correctly on CSE unix environment, and compile using g++ compiler using makefile.

  Create the external javascript file.

Using a text or HTML editor modify your lab5xx.htm page (see above) and save it as lab6xx.htm.

  Create design of very simple racing game

Create a very simple racing game of your own design. Making a game from the ground up is a lot of effort, so let's keep things basic.

  Invent a fictitious company in one of the given industries

please provide a step-by-step progression toward the desired product.invent a fictitious company in one of the

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd