{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework and midterm

# There are 0 64s in 42 there are 1 32s in 42 there are

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: = 6 k= 6 m= 7 n= -6 . 18. Given the following code fragment, write the value of the variables after the fragment executes: i = int b=2; int i=0; for(i=0; i<2; i++){ b+=i; } b -= i; 2 b = 1 . 2 19. Convert the unsigned decimal number 42 to an 8 ­bit binary number: 27=128 26=64 25=32 24=16 23=8 22=4 21=2 20=1 there are 0 128’s in 42. there are 0 64’s in 42. there are 1 32’s in 42. there are 0 16’s in 10. there are 1 8’s in 10. there are 0 4’s in 2. there are 1 2’s in 2. there are 0 1’s in 2. 42 remaining 42 remaining 42 ­32 = 10 remaining 10 remaining 10 ­8= 2 remaining 2 remaining 2 ­2=0. 0 remaining start copying from the first 0 at the top, you have 00101010. (42)10 = (00101010)2 20. Convert the following 8 ­bit binary number to an unsigned decimal number (N.B: Most significant bit is on the left): 00001111 27=128 26=64 25=32 24=16 23=8 22=4 21=2 20=...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern