Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Test Review Questions- Spring 2007

Can we access the answers to the review questions so we can find out whether or not we're on the right track while studying?
Answers won't be posted. You can post the answers to the review questions on this page and a TA can tell you whether its right. Also, TA's will go over some parts of the review this week in recitation. - Bobby Mathew

I guess we could always copy/paste it into JES and see if we are right that way
Yeah, that should work for the tracing questions and some of the coding questions. - Bobby Mathew

I copied and pasted the tracing functions into JES and either there are typos in the code or the functions have the same errors in them that dont allow them to run, i.e. print something out. any insight to this dilemma?
Two separate points: First, the last two functions in "Follow the functions" had minor typos (the "for" lines didn't end in colons). You could really have found those errors and corrected them yourself, although you shouldn't have had to, and we will double check the actual test questions more carefully. Sorry! They are now correct. Secondly, some of the functions print values using "print" commands, and others just return values – the return value being printed in the command area as the result of the function. Review your understanding of the difference between print and return either by trying out the examples or looking up the topics in the book or sample code. If a function neither prints nor returns, then "nothing" would be a valid answer. That's not a trick question; plenty of functions (like many of the picture manipulation functions we have been writing) neither print nor return values. Colin Potts

Under follow the functions- in the function Harry there is a variable that isnt defined. answer is never given and initial value so wouldn't it end in an error? Are we just supposed to assume that there is a line before the for loop that says answer=0 or something like that?
Yes, there has to be a statement like that. Its a typo. I've changed it on the review page. - Bobby Mathew

In the "Follow the Functions" assignment count is used. I might have missed this, but what does count do? I found a reference on page 221 of the book, but I am unsure what it does in the functions of the review problems.
'count' is a just random variable to keep track of in the 'for' loop. You can name it anything you want. - Bobby Mathew

also what does "index" do
Same as answer above. Just a random variable, like saying for p in getPixels(picture), p can be any name - Bobby Mathew


For color channels, should we consider the composite as one, or just the pure colors?
Pure colors - Bobby Mathew

this may seem silly but i dont get what is meant by channels can u define tht for me
A color channel is the same thing as a color component. Every pixel has 3 color channels (RGB) and each channel is 1 byte in size. - Bobby Mathew

In the function that asks you to set the pixels below the line x=y black, what if statement do you use? I know how to do it if the line is straight across or down, but I can't figure out how to set only the pixels below the x=y line black.
When x=y, the line is diagonal. Everything below the x=y line means that x values are always lesser than y. Try to base your 'if' condition on that. - Bobby Mathew

Does the second question in Pixel play essentially do nothing, or am I following it wrong?
No, you're right. There's only one pixel to change but that doesn't satisfy the 'if' condition so in the end nothing changes. - Bobby Mathew

wen we create our gray scale their r two ways one empirical and one simple in our book which is appropriate for the test?
Just the simple way - averaging the rgb values and setting the rgb values to that average. - Bobby Mathew

is the "for in" statement the beginning of an iteration or the beginning of a conditional statement?
For the interation a "for" loop is the correct answer. So now you need answer the question "What's the beginning of a conditional statement?". Any guesses? Toni Walden


for follow the functions on the test review, I don't understand "grover". def help1 only has (a, b) not (c, d) and do we use (1, 2, 3, 4) in help1 & help2 too, as in a=1, b=2, c=3, d=4?
Remember that a the names of a function's inputs are arbitrary and have nothing to do with variables in other functions that happen to have the same names. a and b are just the names of the two inputs to help1. Now, what two values is grover giving to help1? The first one is going to be called a inside help1, and the second one is going to be called b. Colin Potts


I dont understand how slimey(1,2,3,4) returns 9? I dont understand why harry returns 15. What does answer + help1(c,a)? I am so confused on these.
As for slimey, you can obviously ignore (i.e. delete or comment out) the a, b, and c lines inside the loop, since only d is returned, and d doesn't depend on anything else. Ok. d starts off with the value ..... what? (Hint: It's an input to the function). And each time through the loop it gets one larger. How many times is the loop executed? (Hint: range(1,5)). So it's that amount larger than it was when it started out.... which happens to be 9. You can use the same reasoning for harry. It looks a bit more complicated because some of what harry does is done by another function, help1, but that doesn't change anything really, and you should have been trying out functions in JES for the past few weeks. It will click eventually. If you're still confused after the test, you should see Cedric or me or your TA and go over functions and inputs so that it clicks sooner rather than later! Colin Potts

I guess this is a review question since it helps me know what to review...will there be any long drawn out code writing such as posterizing and copying or will they be kept short and sweet like demonstrated in the practice examples. If you can at all answer a question like this thanks but if not I understand.



Links to this Page