a01-key - Assignment 1 Comments and Key CSci 1001, Spring...

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

View Full Document Right Arrow Icon
Assignment 1 Comments and Key CSci 1001, Spring 2010 February 10, 2010 1 General Comments Who Graded What : If you have questions on any of the solutions here, or general grading questions, feel free to see any of the course teachers or TAs. If you think we missed something and that the grading is incorrect, please ask the grader for a regrade within a week of the day the homework is returned. Here’s who graded what on this assignment: Problem 1: Tyler Smith Problem 2: Faraz Mohammad-Mirzaei Problem 3: Jonathon Lawson Problem 4: Phil Barry A few general comments: If you didn’t do well (or didn’t do as well as you had hoped) on this assignment, please (i) look over this key, and try to understand well what you did wrong, (ii) look over the ±le, on the course web page, of tips for doing well in this class, (iii) make use of o²ce hours. Please read the problems carefully and make sure you understand what they are asking. Some people lost points because they answered the wrong question. If you have any question about what a problem is asking for, please ask about it. Please remember that if you handwrite your assignment, it must be very neat . We had some problems with semi-legible handwriting, so please be particularly attentive to this in future assignments. 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
2
Background image of page 2
2 Problem 1: Reading Algorithms Problem 1.1 : See Figure 1 Problem 1.2 : 1 2 3 sum =6 Problem 1.3 : 1 2 3 6 7 14 21 sum =54 Problem 1.4 : If n is negative the loop continuation condition i < n will be false imme- diately, so the loop body is never executed. However, line 9 will still be executed, always printing sum=0 . Problem 1.5 : Since the loop only executes for i < n , line 6 will never print out the value of n . So the only possibility will be line 9. This will print out the value of n if and only if the numbers that divide n evenly also sum to n (as occurs for n = 6, for example). 3 Problem 2: Decrementing a Countdown Timer
Background image of page 3

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

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

Page1 / 7

a01-key - Assignment 1 Comments and Key CSci 1001, Spring...

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

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