Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given a piece of Java code below in which we define five variables a, b, c, d, a

ID: 3750938 • Letter: G

Question

Given a piece of Java code below in which we define five variables a, b, c, d, and e

public class problem1 {

            public static void main(String[] args) {

                                               

                        short a = 1200;

                        short b = -200;

                        char c = 'x';

                        char d = 'y';

                        float e = (float) 6.25;

            }

}

What is the 16-bit binary number of variable a stored in memory

                       

Rewrite the 16-bit binary number of variable a into the hexadecimal number

                       

What is the 16-bit binary number of variable b stored in memory

                       

Rewrite the 16-bit binary number of variable b into the hexadecimal number

                       

What is the 8-bit binary number of variable c stored in memory

                       

Rewrite the 8-bit (1 byte) binary number of variable c into the hexadecimal number

                       

What is the 8-bit binary number of variable d stored in memory

                       

Rewrite the 8-bit binary number of variable d into the hexadecimal number

                       

What is the 32-bit binary number of variable e stored in memory

                       

Rewrite the 32-bit binary number of variable e into the hexadecimal number

Explanation / Answer

What is the 16-bit binary number of variable a stored in memory?

Ans :-  0000010010110000

Rewrite the 16-bit binary number of variable a into the hexadecimal number?

Ans :- 4B0

What is the 16-bit binary number of variable b stored in memory?

Ans :- 1111111100111000

Rewrite the 16-bit binary number of variable b into the hexadecimal number?

Ans :- FF38

What is the 8-bit binary number of variable c stored in memory?

Ans :- 01111000 ( small x ASCII value is 120 so 120 in Binary Format )

Rewrite the 8-bit (1 byte) binary number of variable c into the hexadecimal number?

Ans :- 78

What is the 8-bit binary number of variable d stored in memory?

Ans :- 01111001    ( small y ASCII value is 121 so 121 in Binary Format )

Rewrite the 8-bit binary number of variable d into the hexadecimal number?

Ans :- 79

[

What is the 32-bit binary [umber of variable e stored in memory?

Ans :- 01000000110010000000000000000000

Rewrite the 32-bit binary number of variable e into the hexadecimal number?

Ans :- 0x40c80000

] Note :- This floating point convertion according to the IEE-756 Rule

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote