Question: a. byte a = 127; // 0x7F System.out.println(++a); int b = 0xFFFFFFFF; // hex representation System.out.println(++b); [3 points] In Java programming language the data types

a.

byte a = 127; // 0x7F

System.out.println(++a);

int b = 0xFFFFFFFF; // hex representation

System.out.println(++b);

[3 points] In Java programming language the data types byte and int are 8-bit and 32-bit twos compliment integers. What will be printed when the following code snippets are executed (0x Hex)? Which of these operations results in an overflow? Justify your answers.

b. [3 points] The floating-point format to be used in this problem is an 8-bit IEEE 754 normalized format with 1 sign bit, 3 exponent bits, and 4 mantissa bits. It is identical to the 32-bit and 64-bit formats in terms of the meaning of fields and special encodings. The exponent field employs an Excess-3 coding (given below). The exponents 000 and 111 are reserved.

000 (reserved)

001

010

011

100

101

110

111 (reserved)

-2

-1

0

1

2

3

Encode the following decimal numbers in the above 8-bit IEEE format:

(1) -4.25 (2) 8

c. [3 points] Decode the following 8-bit IEEE representation into their decimal value: (1) 1 011 1000 (2) 0 100 0000

d. [3 points] What are the encodings for zero?

e. [3 points] What are the largest and the second largest positive numbers?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!