Final Exam Review Questions- Fall 2007
Questions?
It seems as if there are a lot of things on the review that include "writing" code. In the past on our other tests there weren't very many instances in which we had to write a complete code. Will that be different for the final? Will we have to write most of the code from scratch? Also, how many questions will there be on the final and how equally are the questions divided between each section that we learned (as in.. will there be more questions from any particular topic)? Thanks
| There will code writing and code understanding questions, but you won't have to write any code from scratch. What that means is EITHER that you will be given a template to complete OR that you will be asked to write a function with another function being given as a strong hint or model to follow. Most, though not all, the questions on the review are from previous tests, previous reviews, and even pop quizzes. They are therefore pretty representative, and because of where they come from they are not much more skewed toward coding examples than the tests were. Where there are a few more code-related questions on the review, that's because I took advantage of the many posted examples and used them to ask questions that test your understanding. Some of them are not the kinds of questions that I will put on the test but they test your understanding in ways that will help you prepare. As far as topics are concerned, the balance between the questions will be similar to the amount of time we spent on topics during the semester. If you just look at the amount that is posted on the slides/codes page that will give you a good estimate of the overall balance. So will looking at the topics on each of tests 1...4 (although the gap between numbers 2 and 3 was shorter than the others, I think.) Some questions WILL be similar to previous test questions, so looking at them and reviewing your answers where they were incorrect should pay off. Colin Potts |
I get an error when I try to run this code I wrote for the blue dotted line; it tells me there is an inappropriate argument value of the correct type on line 9...help please.
def yellowDottedLine():
pic = makeEmptyPicture(200, 200)
width = getWidth(pic)
midX = width/2
height = getHeight(pic)
midY = height/2
value = 0
for p in getPixels(pic):
setColor(getPixel(pic, midX + value, midY + value), blue)
value = value + 2
print(value)
show(pic)
Try using a while loop that will keep it working as long as midX + value is less than the width of the picture.
| Scroll up in JES and read the entire error message. It tells you what value is incorrect. See if you can work out why it is getting an invalid value. Colin Potts |
What do the elipses in the revised testAverage code mean?
How many distinct sound values can a sample have when using the sound encoding that we have been using? Would this be 11...or could you give me direction, as to where I could find this THANKS!
| There are two bytes per sample in the WAV file encoding we have used. Two bytes is how many bits? You can find out how many possible values can be represented by raising two to that power. Colin Potts |
“Some of the WAV files you may have downloaded or heard demonstrated in class are one-byte sounds. What are the maximum and minimum values for samples in such a sound?” For one-byte sounds, I figure that one-byte encoding allows for a maximum of 256 distinct values. If we split the 256 evenly between positive and negative values (and treat 0 as a positive number), then I figure it’d be -128 and +127. Is that correct?
i think alot of people have been doing sort of poor in the class because these reviews are too broad. . .
its too hard to focus on one area, so we end up with basic knowledge for all areas, but that isnt good enough. can you guys be more specific with what is going to be on the final exam. . .i (and other students) feel like the exams might as well be "pop exams"- this review is soooo long, can you all narrow it down?
| No. It's a comprehensive test. Just having a few questions on the first two reviews misled some people into thinking that the questions would be very like them. You don't have to do all the review questions; just pick one or two from each section that look difficult. Colin Potts |
And how many questions will be on the exam? could it be open note?
| There are eleven questions on the exam (naturally). It is not open note. Colin Potts |
can you all just make the final a compilation of all the exams. . . be nice, for once- please!!!
| Let me put it this way. If you did well in the exams, you should do very well in the final. If you got some questions wrong on the tests, you would benefit a lot from understanding why. Colin Potts |
| I'm pretty sure that Colin has been nice a lot recently, not just once. For instance: replacing your lowest test grade with a better grade on the final, giving you 11 questions on the final and then taking the 10 highest to calculate your grade, and by giving you a breakdown of the final to study by. Please be respectful and polite, especially when you are asking for him to do something. Thanks! Brittany Duncan |
OK. If it helps you plan your time, here is the breakdown of questions on the final. There are eleven questions as follows:
- General programming/Python knowledge
- Digitization of media (i.e. pictures, sounds and movies)
- Pictures (two questions)
- Sounds and/or movies
- Text and list processing (two questions)
- HTML
- Turtle graphics
- Object-oriented programming
- Computer science concepts
Each question is worth 10%. We will discard your lowest score.
professor potts is great. . . its just some of the evil ta's, (cough cough)- i think the professor is great- he's funny, nice, etc etc. . . .
why cant the ta's be more like the professor????? Life isnt fair!!!!
yeah, i didnt mean potts be nice for once. . . .i meant everyone (minus the professor-he's soooo nice):-)
This isn't high school anymore, you guys. You're going to have classes here that are a lot harder and less forgiving than this one.
| In point of fact, this is Georgia Tech. Anyone who feels this class was unforgiving is going to be in for a rude shock soon enough (I can't really speak to it being hard...difficulty is largely dependent on the person, some might find this class extremely challenging, who find subjects that make me shudder at the very thought of to be very easy). Chris Phillips |
I just wanted clarification, the finial is on Monday at 2:50 in the same classroom. Is this correct?
You people (students I mean), are so mean, criticizing TAs and the Professor who are doing so much for you. In the high school I was in, teachers gave students such a hard time. Do you even realize that your TAs are students like you, studying for finals (in the third, or fourth year, think of it!)? The point is make the most of what you've got and stop blaming others for a change. Thank you.
Seriously- I'm a fourth year and If you think this class is unfair, good luck ever graduating. I think the reviews (except exam 3) were an absolute gift. Most profs won't make it that clear. Thanks to those who put in the work to make the reviews and thanks to professor Potts for substituting the final grade for the lowest test grade.
I don't get what this question is asking: Modify the posterize function so that it is a true function. I.e. you should be able to type pic2 = posterize(pic1) and have pic2 be a posterized version of pic1. (it seems like it already works?)
| Try running it in JES. Instead of typing posterize(pic1), instead type pic2 = posterize(pic1) followed by show(pic1). Does it really work? If not, what would you have to do to posterize to make it work? Colin Potts |
def revisedTestAverage(tests, final):
testTotal = 0
final = final
for testScore in tests:
m = min(final, testScore)
for testScore in tests:
testTotal = testTotal + testScore
if final > m:
testTotal = testTotal - m + final
return testTotal/ len(tests)
This code is not yielding exactly what it should. Help.
yeah like forget about the indentation, that was all correct.
| You left out the code tags that I have been telling people about all semester. Colin Potts |
| So, what exactly is wrong with what this code produces? Colin Potts |
| You are calculating replacing any test grade that is lower than the final. If you are trying what I did in class, you should have a variable called "lowestTest" and it should start as 100 and be replaced by anything that is lower than it is. Thanks! Brittany Duncan |
well that posterize function worked fine when I did what the Professor suggested..my pic looked weird..
| Oops – typo – sorry. Here's what I meant to say: Try running it in JES. Instead of typing posterize(pic1), instead type pic2 = posterize(pic1) followed by show(pic2). Does it really work? If not, what would you have to do to posterize to make it work? (You need to make sure that posterize returns a picture, and ideally doesn't change pic1.) Colin Potts |
the average doesn't come correct exactly
it was off by a point
oh ok, got it, forget about it
Will all the 10 questions be worth 10 then?
oh wow, thanks!
def whatever():
>>width = 500
>>height = 500
>>canvas = makeEmptyPicture(width, height)
>>midX = (width / 2)
>>midY = (height / 2)
>>for p in range(midX, width, 2):
>>>>r = getPixel(picture, p, midY)
>>>>setColor(r, blue)
>>show(canvas)
Why isn't this function working? it just produces a blank screen
oh ok sorry got the error..
What is the luminance question on Test 1 Review trying to get at?
| The weighted average luminance referred to there is something that we didn't cover in class this semester, but which gives a better black-and-white image (more "snappy" as photographers say) than a straight average of the RGB values. But the question isn't actually asking you to turn an RGB picture into a B&W picture, just to test three RGB values and respond as specified. Colin Potts |
The review is awesome, but I also like to read the book to reinforce what is on the coweb. Could one of the TAs please post the corresponding chapters/sections of the book that the final will cover? Thank you so much!
| Look at the Slides and Code page. Not only are the slides more useful (in my opinion at least) then the book is, but it also lists what chapters correspond with each topic. Chris Phillips | |
Help me in both the bouncing rectangle questions, please!
| (a) This isn't a question. (b) You can answer the second question by just loading the code and making the change. Have you done that? Colin Potts |
In the censor question, when I take input string with single quotes around it(as opposed to double quotes), the censor program acts weird. Why?
| "Weird" is not a symptom I can explain. It does work for me, though. Colin Potts |
Oh ok, sorry, I mean it ends up like this in the command area:
Our campus is in Atlanta. Our colors are gold and black. Go jacketsgoldr campus is in Atlanta. Our campus is gold and black. Go dogsAtlantaampus is in Atlanta. Our colors are gold and black. Go jacketsgold r
| Hmmm. If I type s2 = censor('Our campus is in Athens. Our colors are red and black. Go dogs!') or if I assign that string to s1 and then say s2 = censor(s1) I get the correctly changed string and not what you get. I don't think your problem is anything to do with single vs. double quotes. Are you sure you didn't mistype the program? It looks like you are splicing the entire string at some point rather than a part of it. Colin Potts |
| More.... A tiny change can have a big effect that is difficult to reason backwards from. On a hunch, I deleted the [0: position] in line 9 and got the following output: "Our campus is in Athens. Our colors are red and black. Go dogs!gold and black. Go dogs!jackets!gold and black. Go dogs!Atlanta. Our colors are red and black. Go dogs!gold and black. Go dogs!jackets!gold and black. Go dogs!" It's not what you got, but it's almost art. Colin Potts |
I figured out the answer to b! Basically the rectangle grows in size, because when it changes the position the rectangle at the new position gets continuously joined to the rectangle at the old position.
Oh thanks a lot Professor for helping on the censor
Is there any way we could get the answer to Exam 3, part B for the fill in the blank code def makeNoisy(...)??Thank you so much! It's hard for me to know how to figure out where I went wrong w/o answers to the tests or reviews, but thanks again!
| Sorry, I can't post the whole answer. Why don't you ask the TAs to go over this question in the review session this evening? Thanks! Brittany Duncan |
| Why is it so hard? You can write a program and try it out in JES. Don't expect to be spoon-fed answers. Hint: Start out by writing a program that just adds a constant amout to every sample, and then work out how to add a random amount. Colin Potts |
What does it mean when something is underlined and in blue in JES? Or maybe at least a hint?
| Hint: I've never seen anything underlined in JES. The question is about HTML, not Python. Colin Potts |
Brittany, what do you mean by lowestTest "should start as 100"? How do you start it as 100? I am having a really hard time with this problem.
| Well, this is just the way that I would do it, but I would create a "lowestTest = 100" variable before the loop, then take the min of that versus each of the testScores. E-mail me if you need more explaination than that, I don't want to give away the whole answer. Thanks! Brittany Duncan |
I don't understand binary searching, help?
| When you were younger, did you ever play a variant of the high-low game? Like, someone says "I'm thinking of a number between 1 and 50", and you, maybe your entire class, or something, had to try and guess it? And after each guess, the person would say "It's higher then that" or "It's lower then that"? Well, you -could- go through and try every number, in some sort of arbitrary order (so you could do 1, 2, 3...etc, which is arbitrary)...which would take forever. Or, you could start by guessing the number in the middle, 25. They say "It's higher then that". You've just cut down the possibilities by 1/2, from 50 possibilities, to 25 possibilities (26-50). Then try the middle again, so 38. They say "It's lower then that". You've just cut down the possibilities by 1/2 again, you know it's between 26 and 38. Etc. You eventually will zero in on the number this way. Binary search works exactly like that, you have a list of items, that are in some sort of order. You zero in on the middle item, check to see whether the item you're looking for is higher or lower then that one. From there, you look at the subset (from the beginning to the middle if the item was lower then the middle, from the middle to the end if the item was higher), check the middle value of that, and repeat until you find the element you're looking for (or you get down to 1 item, see that it isn't it, and know that the item you're looking for is not contained in the list). Chris Phillips |
Hey thanks Chris that is an amazing explanation!
And how do we do the palindrome string function?
def palindrome(string1):
if string1 == string1[::-1]:
print "1"
else:
print "0"
...or more simply (better to return than print)
def palindrome(string1):
return (string1 == string1[::-1])
But if you don't understand the string slicing notation, which is a bit tricky, you can loop through the string comparing the first and last characters, the next-to-first and next-to-last, etc. until you either meet in the middle or find two characters that aren't equal.
You can even do this recursively: if the first and last characters are the same, well the string could be a palindrome, but only if the rest (the middle of the string with the first and last characters removed) is a palindrome; and that is a palindrome if.... This obviously won't loop forever, because you're always checking smaller and smaller strings, so your base case is to check whether the string is zero or one character long, in which case it's a palindrome by definition. Colin Potts
Thanks! Can someone help me understand the textToSound and SoundToPicture functions too? After that, I am like done..(woohoo!)
First, the textToSound function only works in conjunction with the soundToText function. (You must have converted your sound to a long string of numbers first for the file to make sense. You can't read any text file and expect it to play as a sound.) Here's that function as shown in class:
def soundToText(sound,filename):
file = open(filename,"wt")
for s in getSamples(sound):
file.write(str(getSample(s))+"\n")
file.close()
So textToSound just reads in each line as a number, puts that value in a sample, and bingo you have a sound again.
soundToPicture works by converting samples into pixel values for a picture that "visualizes" the sound. Each pixel in the picture corresponds to a sample in the sound, and the louder the sound, the more red or blue specks there are in the picture. The quieter it is, the greener the picture is. Colin Potts
Thanks!
Thanks for the final review it was extremely exhaustive and I feel doing it properly was extremely valuable! I should get the minimum required for an A :D.
On the posterize question, would adding: "return pic"
without quotes at the end be correct?
| That would return the picture correctly, but if that is all that you did, you would also be changing the picture that you passed in. The question asks for a pure function, which means that the inputs are not changed. (Hint: You need to make a copy of the picture before changing it.) Colin Potts |
how do you find the distance between black and blue ... i.e. distance(black,blue)
| That would work in JES, because the distance function takes two colors, and black and blue are two predefined color names. To do it manually (which isn't necessary for these two colors), you would say distance(makeColor(0,0,255), makeColor(0,0,0)) Colin Potts |
use the distance formula:
sqrt((r1-r2)^2+(g1-g2)^2+(b1-b2)^2)
What is a break?
| Break tells the function to "break" or exit out of the loop. Pass on the other hand just tells the loop to continue on. Thanks! Brittany Duncan |
1 def change(pic):
2 newValue = 255
3 for p in getPixels(pic):
4 setRed(p, newValue)
how many times is line 4 executed?
It is executed p times, or as many times as there are pixels. Number of pixels = width height of picture (Not a TA)
make that width multiplied by height
Does anyone have the test average code that Brittany did in class Friday? Apparently I'm an idiot and didn't save it.
| I do. E-mail or AIM message me and I will give it to you. Thanks! Brittany Duncan |
would you say that the level of difficulty of the questions on the final is higher than that of any of the tests? For instance, the level of picture manipulation on Exam 1 was very very basic compared to all the example questions on the review about darkening some quadrants and negating others, copying pictures, etc. Also, how many parts will there be to each of the 11 questions?
| I'd say the questions are similar to those on the tests, so it should be about the same in difficulty. The number of parts to the questions depends on the question. Some of them are 10 multiple choice/short answers; others are one question. But all have partial credit answers. Colin Potts |
thanks
for a 2 byte sample sound, that means that the value is 2^16, so the range is -32k..+32k-1 ???
if i could make 100s on all my tests if i took them over again do you think i will be good for at least a low B on the final.. thats all i need for an A
hehe :)
i don't know but im hoping so bc im in the same boat.
the Turing Test allows us to say whether a program we're interacting with is intelligent?
| You seem to be tentative about that. Do you have a problem with programs being intelligent? Eliza |
To the person who asked the 100s question, it is quite possible to do all 80s in your midterms and still score an A (with the same kind of score on the final), if everything else (homeworks, quizzes) are fine :D.
What IS a network client? I still don't get it..
| Any program that interacts with the network to get a service - e.g. your email program, browser, IM client, iTunes when interacting with the online store. Colin Potts |
how do you do the white noise problem?
what are the effects in one word each for the following 2 code sets:
def mystery1(pic):
for currentPixel in getPixels(pic):
setRed(currentPixel, getRed(currentPixel)/2)
setGreen(currentPixel, getGreen(currentPixel)/2)
setBlue(currentPixel, getBlue(currentPixel)/2)
def mystery2(pic):
for currentPixel in getPixels(pic):
setRed(currentPixel, 255-getRed(currentPixel))
setGreen(currentPixel, 255-getGreen(currentPixel))
setBlue(currentPixel, 255-getBlue(currentPixel))
how do i calculate my average again?
| Your baseline test average is the arithmetic mean of your tests. The alternative is to replace your lowest test grade with your final grade and then compute the average once you've done that replacement. Your revised test average is the higher of these two alternative computations. (Obviously, if you do worse on the final than on all your tests – something we don't want to think about today – you will use your baseline average.) Colin Potts |
why do current movies and videos have faster frame rates?
| (1) Less flickering. (2) Easier to synchronize with soundtrack. Colin Potts |
how many bytes are in a RGB color?
one 8-bit byte stores each color value
and there are three color values...so three!
if wearing green clothes in front of a green screen using chromakey, will the person wearing green clothes bleed through the background?
From what I understand, the guy's face and body will appear detached on the new background..think of what happens when you do chromakey..the monocolored background the guy is against, disappears. So if the guy has a color close to the background, only the non-green parts of the small pic, like his face, hands, etc will appear on the new background (like the weathermap).
what do picture I/O and sound I/O stand for?
input/output
Input/ Output
input/output? I'm not really sure. ^^'
is white (0,0,0)? and black (255,255,255)
| You got it reversed. Black is (0,0,0) and white is (255,255,255). Thanks! Brittany Duncan |
min(listOfNumbers) returns the lowest number in the list, right?
why does music recording require a greater sampling rate than a phone conversation for
accurate reproduction?
| Maybe the question is not very well worded. The point is that we choose to put up with lower quality sound in a phone conversation than a CD/MP3 recording. That means that we don't need as high a sampling rate for the phone. Colin Potts |
This is related to Nyquist Theorem. Basically, human voices never go above 4000 Hz. Nyquist Theorem says you need twice the many samples as frequency to properly represent sound. So you need 8,000 samples per second to represent human voices accurately. On the contrary, a music recording represents a much wider range of sounds, here upto 22,000 Hz. So it uses 44,100 samples per second (44100 = 22050 * 20, the extra 50 Hz is for the fudge factor and recording accuracy purposes.)
sorry make 22050 * 20 from the last post 22050 * 2
Yo thanks people! I'll miss you all.
Link to this Page