5. [16 points] For this problem, consider a hypothetical 10-bit machine that supports both signed and unsigned arithmeti

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

5. [16 points] For this problem, consider a hypothetical 10-bit machine that supports both signed and unsigned arithmeti

Post by answerhappygod »

5 16 Points For This Problem Consider A Hypothetical 10 Bit Machine That Supports Both Signed And Unsigned Arithmeti 1
5 16 Points For This Problem Consider A Hypothetical 10 Bit Machine That Supports Both Signed And Unsigned Arithmeti 1 (155.7 KiB) Viewed 29 times
5. [16 points] For this problem, consider a hypothetical 10-bit machine that supports both signed and unsigned arithmetic. On this machine both int and unsigned are encoded using all 10 bits, while char and unsigned char are encoded using 5 bits. Assume as well that two's- complement encoding is used for the signed values. For each of the following code snippets, indicate what is printed out by the print f statement. (a) [2 points] int a 288; char c = (char) a; int b = (int) c; printf("%d", b); Output: (b) [2 points] int a = 147; char c = (char) a; int b = (int) c; printf("%d", b); Output: (c) [2 points] int a 147; unsigned char c = (unsigned char) a; int b = (int) c; printf("%d", b); Output: (d) [2 points] char c= -7; int a = (int) c; unsigned b = (unsigned) a; printf("%u", b); Page Output: 8 of 10 C | ZOOM +
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply