Quiz #1 - Anirudh Pande EE322C- Dr. Y 2/4/09 Quiz #1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Anirudh Pande EE322C- Dr. Y 2/4/09 Quiz #1 Snippet # 1 Guess: 1 # 2 Reality: Error: Possible loss of precision. To fix error, do type conversion int i1 = (int)5.0 * 2 / 4; Now, the result is 1 # 2. Reasoning: This code snippet returns the correct predicted value after the error is fixed. The compiler expects i1 to be a double variable since there are decimal values on the right side of the equal sign. The snippet will not compile until this error is fixed by type conversion. Snippet # 2 Guess: 2 # 64 Reality: 2 # -1 Reasoning: The predicted value was erroneous due to the fact that I was mistaken about how the command .MAXVALUE executes. Snippet # 3 Guess: 3 # -1 3 # 5 Reality: 3 # -1 3 # 5 Reasoning: The guess was inaccurate due to the fact that there was no new line command inserted in the code snippet so the display is actually shown on just one line. Otherwise, the remainder values were predicted accurately. Snippet # 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/17/2010 for the course EE 322C taught by Professor Nettles during the Spring '08 term at University of Texas at Austin.

Page1 / 5

Quiz #1 - Anirudh Pande EE322C- Dr. Y 2/4/09 Quiz #1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online