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 Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Pre Quiz 2 Question Page Spring 2006

Pre Quiz 2 Questions:


Will returning a picture within a for inside of another for loop end the function?

Yes, any time return is placed within a function, the function will stop after seeing the return.

is the answer to question #3 num10+num?

No. The answer is going to be the literal value or values that the function prints, not the names of variables. Ask the following questions: (1) How many times is the 'print' command going to be executed inside the function? The function is going to print as many numbers as there are executions of the print command. (Clue: For loops. Indentation....) Then ask (2) What the value printed is going to be each time? If you can't work this out, (3) type the code into JES, execute it, and then work out exactly why it prints what it does. You won't be able to do that in the quiz, of course, but it may help prepare for analogous questions. Colin Potts

is the answer to #6 c?
If 'picture = makePicture(f)' works (i.e. 'f' is a picture file) why should there be a problem passing 'picture' as a parameter to makeSnazzy()? Are you bothered by the fact that picture is returned by the function? If so, you're on the right track.... Colin Potts

In question one are we putting the 3x3 picture onto the 5x5 picture?
Yes, but where on the 5x5 picture? -Albert d'Heurle

For number three... with the for loop inside the other for loop does it mean that it goes through one round in the lower one and then back to the top one (so that s is reset every time) or does the second for loop just keep going until it runs out and then it is finished?
Think about the definition of a for loop and how many times it will run depending on the value in the parentheses.Liz Helms

for question 6, is it D? You don't need to return picture because JES automatically remembers the alterations done on a particular picture. Is that right?
This is true, but is there an actual error caused by leaving return in this function, and why is/isn't this a problem? Liz Helms


please explain how JES prints out
5
55
555
5555
55555
for question 3?
click here,and scroll to the bottom of the page

On Question 6: Is it just an indentation error for the 'return' command?
yes. Where should the return be? -Albert d'Heurle

for question 3, would you put the 3x3 picture on the 5x5 over 2 and up 1?

In regards to question 3: what tells JES to print each iteration?
The print command in line 6 of the function. Liz Helms

For question 3, would the 3x3 picture start on the 5x5 picture at 3,2?

Is #4 D? lol

For #3 why is the first 5 printed out. Why wouldnt the first printed number be 55?

For no. 6, I get that the return is in the command and this is bad- I just dont understand which error is printed. Last week my TA said D, but now based on above questions, I'm thinking this isnt right-?

That's right. It's a logical error, because the indentation mistake doesn't make the program invalid; it merely causes it to return too early and with the wrong value. Colin Potts

Do you mean, for question 2 would the 3x3 picture start on the 5x5 picture at 3,2, which is over 2 and up 1? Because that's what I think it would be too, but I'm not sure



Link to this Page