⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http:^^www.cs.wisc.edu^~cs354-2^cs354^solutions^q2.j.html

📁 This data set contains WWW-pages collected from computer science departments of various universities
💻 HTML
字号:
Date: Tue, 05 Nov 1996 00:32:09 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Sat, 28 Sep 1996 19:29:11 GMTContent-length: 5230<!--This file created 9/26/96 8:39 PM by Claris Home Page version 1.0b1--><HTML><HEAD>   <TITLE>Q2.m.html</TITLE>   <X-SAS-WINDOW TOP=-22 BOTTOM=510 LEFT=-755 RIGHT=-184></HEAD><BODY><H3 ALIGN=CENTER><B>CS354, Fall 1996 </B></H3><H3 ALIGN=CENTER><B>Quiz 2, Section 1 (9/27), Section 3 (9/25)</B></H3><H3><TABLE BORDER=1 CELLPADDING=1 WIDTH="100%">   <TR>      <TD>         <P><B><FONT SIZE=4>Name (printed):</FONT></B>      </TD><TD>         <P><B><FONT SIZE=4>Name (signed):</FONT></B>      </TD></TR></TABLE></H3><P><B>Grader:</B></P><P><TABLE BORDER=1 CELLPADDING=1 WIDTH="21%">   <TR>      <TD>         <P>Mohammad      </TD><TD>         <P>&nbsp;      </TD></TR>   <TR>      <TD>         <P>Sridevi      </TD><TD>         <P>&nbsp;      </TD></TR>   <TR>      <TD>         <P>Sunlung      </TD><TD>         <P>&nbsp;      </TD></TR></TABLE></P><P><B>Total score:</B></P><P>(1, ver 1) (2 points) Convert 111<SUB>3</SUB> to base 10.</P><BLOCKQUOTE><P><B>ANSWER</B></P></BLOCKQUOTE><DL>   <DD>1 + 3 + 9 = 13<SUB>10</SUB></DL><P>(1, ver 2) (2 points) Convert 333<SUB>9</SUB> to base 10.</P><BLOCKQUOTE><P><B>ANSWER</B></P></BLOCKQUOTE><DL>   <DD>3 + 3 * 9 + 3 * 81 = 273<SUB>10</SUB></DL><P>(2, ver 1) (2 points) Convert 45<SUB>10</SUB> to base 2.</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT><CODE>45 rem 2 = 145 div 2 = 2222 rem 2 = 022 div 2 = 1111 rem 2 = 111 div 2 = 55 rem 2 = 15 div 2 = 22 rem 2 = 02 div 2 = 11 rem 2 = 11 div 2 = 0&nbsp;so we get:</CODE></TT> 101101<SUB>2</SUB></PRE></BLOCKQUOTE><P>(2, ver 2) (5 points) Write -45<SUB>10</SUB> as a 32 bit, 2'scomplement number.</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT><CODE>45 rem 2 = 145 div 2 = 2222 rem 2 = 022 div 2 = 1111 rem 2 = 111 div 2 = 55 rem 2 = 15 div 2 = 22 rem 2 = 02 div 2 = 11 rem 2 = 11 div 2 = 0&nbsp;so we get:</CODE></TT> 45<SUB>10</SUB> = 101101<SUB>2</SUB>pad to 32 bits: 0000 0000 0000 0000 0000 0000 0010 1101flip bits:      1111 1111 1111 1111 1111 1111 1101 0010add 1:          1111 1111 1111 1111 1111 1111 1101 0011 &lt;- ans</PRE></BLOCKQUOTE><P>(3, ver 1) (2 points) Convert fac<SUB>16</SUB> to base 8.</P><BLOCKQUOTE><P><B>ANSWER</B></P><P>fac<SUB>16</SUB> = 1111 1010 1100<SUB>2</SUB> = 111 110 101100<SUB>2</SUB> = 7654<SUB>8</SUB></P></BLOCKQUOTE><P>(3, ver 2) (2 points) Convert fca<SUB>16</SUB> to base 8.</P><BLOCKQUOTE><P><B>ANSWER</B></P><P>fca<SUB>16</SUB> = 1111 1100 1010<SUB>2</SUB> = 111 100 111010<SUB>2</SUB> = 7712<SUB>8</SUB></P></BLOCKQUOTE><P>(4, ver 1) (4 points) Convert 45.40625<SUB>10</SUB> to base 2.</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE>2 * .40625 = 0.81252 * .81250 = 1.6252 * .62500 = 1.252 * .25000 = 0.52 * .50000 = 1.02 * .00000 = 0.0&nbsp;so we get: 101101.01101<SUB>2</SUB></PRE></BLOCKQUOTE><P>(4, ver 2) (5 points) Write 45.40625<SUB>10</SUB> in IEEE FPSform.</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE>45.40625<SUB>10</SUB> = 101101.01101<SUB>2</SUB> = 1.0110101101 *2<SUP>5</SUP>E = 5<SUB>10</SUB> + 127<SUB>10</SUB> = 0111 1111<SUB>2</SUB> + 00000101<SUB>2 </SUB>= 1000 0100<SUB>2</SUB>so we get: 0 1000 0100 01101011010000000000000 &lt;- "S E F" form&nbsp;or: 0100 0010 0011 0101 1010 0000 0000 0000 = 0x4235a000 &lt;- displayform</PRE></BLOCKQUOTE><P>(5, ver 1) (3 points) Consider an IEEE floating pointrepresentation where S is 1 bit, E is 4 bits and F is 7 bits. Writethe largest positive floating point number in the 0x??? displaynotation.</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT><CODE>ans: 0 1110 1111111or:  0111 0111 1111or:  0x77f</CODE></TT></PRE></BLOCKQUOTE><P>(5, ver 2) (3 points) Consider an IEEE floating pointrepresentation where S is 1 bit, E is 4 bits and F is 7 bits. Writethe largest negative floating point number in the 0x??? displaynotation.</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT><CODE>ans: 1 0001 0000000 is the float just to the left of 0.0or:  1000 1000 0000or:  0x880</CODE></TT></PRE></BLOCKQUOTE><P>(6, ver 1) (2 points each) What is the value of the bit pattern,0000 0001 0100 0110, if it represents:</P><P>(a) a 16 bit unsigned binary integer?</P><BLOCKQUOTE><P><B>ANSWER</B></P></BLOCKQUOTE><DL>   <DD><TT>ans: 2 + 4 + 64 + 256 = 326<SUB>10</SUB></TT></DL><P>(b) two ASCII characters?</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT>ans:</TT> 0000 0001 = 1<SUB>16</SUB> = soh, 0100 0110 =46<SUB>16</SUB> = F </PRE></BLOCKQUOTE><P>(6, ver 2) (3 points each) What is the value of the bit pattern,1111 1111 1111 1110, if it represents:</P><P>(a) a 16 bit 2's complement integer?</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT>the number is negative so,flip the bits:</TT> 0000 0000 0000 0001add 1:         0000 0000 0000 0010 = 2<SUB>10</SUB>ans: -2</PRE></BLOCKQUOTE><P>(b) a 16 bit sign magnitude integer (you may leave powers of 2 inyour answer on this one)?</P><BLOCKQUOTE><P><B>ANSWER</B></P><PRE><TT>ans: </TT>- 111 1111 1111 1110<SUB>2</SUB>let x = 111 1111 1111 1110<SUB>2</SUB>so x + 2 = 1000 0000 0000 0000<SUB>2</SUB> = 2<SUP>15</SUP>ans: - (2<SUP>15</SUP> - 2)</PRE><BLOCKQUOTE><PRE>&nbsp;</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -