Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following specification of a laptop to answer the next two questions. Windows 7 Enterprise Processor: Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz Installed memory(RAM)

Consider the following specification of a laptop to answer the next two questions.

Windows 7 Enterprise

Processor: Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz

Installed memory(RAM) 8.00 GB (7.71 GB usable)

System type: 64-bit Operating System

What is the cycle time of the above lap-top?

1/5005 sec

1/ (2 * 109) sec

1/8 sec

1/7.71 sec

Unsigned Integer Representation Consider the following Java program to answer questions 14 15. Java implements char data type as unsigned integer with size 2 bytes. Note that, 216 = 65536

public static void main(String[] args) {

char A = 65535, B = 0;

System.out.println((int)++A);

System.out.println((int)--B);

}

What will be printed in the first line? Why?

a. 65536, because A will be pre-incremented before printing

b. 65535, because 65535 is the largest possible number in 2-byte unsigned representation. A cannot be incremented.

c. 0, because 65535 is the largest possible number in 2-byte unsigned representation. ++A will overflow to the smallest possible number

d. Nothing will be printed.

What will be printed in the second line? Why?

a. -1, because B will be pre-decremented before printing

b. 0, because 0 is the smallest possible number in 2-byte unsigned representation. B cannot be decremented

c. 65535, because 0 is the smallest possible number in 2-byte unsigned representation. --B will overflow to the largest possible number.

d. Nothing will be printed.

What is FFFF-FFFE in 2-byte unsigned integer representation?

a.1

b. 10

c. 111

d. 110

Integer Representation Signed Magnitude & Twos Compliment

What is the disadvantage of signed-magnitude representation (compared to 2s compliment representation)?

a. Two zeros

b. Requires separate hardware units for Adding & Subtracting

c. May need to compare the magnitudes of the numbers before adding or subtracting

d. All of the above

Consider the following Java program to answer questions 18 19. Java implements Short data type as 2s complement integer with size 2 bytes. Note that, 215 = 32767

public static void main(String[] args) {

int x = 32767; y = -32768;

System.out.println(++x);

System.out.println(--y);

}

What will be printed in the first line? Why?

a. 32768, because x will be pre-incremented before printing

b. 32767, because 32767 is the largest possible number in 2-byte 2s compliment representation. x cannot be incremented.

c. 0, because 32767 is the largest possible positive number in 2-byte 2s compliment representation. ++x will overflow to the smallest possible positive number

d. -32768, because 32767 is the largest possible positive number in 2-byte 2s compliment representation. ++x will overflow to the smallest possible number

What will be printed in the second line? Why?

a. -32769, because y will be pre-decremented before printing

b. -32768, because -32768 is the smallest possible number in 2-byte 2s compliment representation. B cannot be decremented

c. 32767, because -32768 is the smallest possible number in 2-byte 2s compliment representation. --B will overflow to the largest possible number.

d. -1, because -32768 is the smallest possible number in 2-byte 2s compliment representation.

--B will overflow to the largest possible negative number.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Outline the two competing definitions of human resource management.

Answered: 1 week ago

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago