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 4 Review Questions- Fall 2007

Questions?

I'm not sure how to best answer the "difference(s) between turtle geometry and coordinate geometry" in the study guide. Is one difference that turtle geometry requires coding to tell a turtle to move and turn while coordinate geometry uses functions like addLine and addRect?

Well, what is the difference in the way that you tell a turtle to draw a square vs. how you tell the computer to draw a square using addRect? Thanks! Brittany Duncan

Does anyone know which textbook chapters will be included on this test?

Is there a chapter on Turtles?

Based on the review a little bit is in Chapter 10 and the rest is in Chapter 13 and 14; I don't think there is a chapter on turtles

When I try to copy the code posted on the recursion question (downUp(word)) to try and manipulate it, jes keeps telling me that a name is not found globally and I need to define word as a function or variable. Why is this happening? I thought word is already defined as a variable in the function.
When you call the function are you passing in a word? Thanks! Brittany Duncan
I am and I'm getting the same error.

I think there is a mistake in the review. Shouldn't it be getXPos and getYPos not getPosX and getPosY for the turtle commands?
Yes. Thank you. Colin Potts

What are constructors? For some reason this is slipping my mind...
For the purposes of this class, the 'def __init__(self):' serves as a constructor. You stick stuff into it you want done at object instantiation. You can also have it simply 'pass', and do nothing, I believe. Chris Phillips

Nevermind! Haha I just wasn't thinking, I figured it out.

can a TA or professor confirm that the chapters that will be covered on the test are 10, 13 and 14? also, would it be advantageous to concentrate on the book, or the review, or both?
Chapters: 10.3-10.5, 11.2, 13, 14.2.1, 14.3, and everything that was covered on turtles in class will be covered on the test. Depending on your own studying style, I'm not sure what would work better for you, but we surely didn't create the review because it was fun for us (;-)). Thanks! Brittany Duncan

Is a difference "between a module like random and a class like String" that modules must be imported while classes are instantiated?
That would be a good way to answer the question, yes. Colin Potts

For the question, "At most, how many copies of downUp are running at once with the
input 'Hello'?" is the answer one? It seems like all the other copies of downUp only have parts of Hello (e.g. ello, llo, lo) as their input.
Impeccable reasoning. The answer wasn't meant to be one, though. The original question should have been worded "If you give downUp the input 'Hello', at most how many copies of downUp are running at once?" Colin Potts

I don't get what the review means by client programs and network programs. Want to be 100 per cent sure.
It was meant to be clients vs. servers. Sorry about that. Colin Potts

For the Moore's law example question. Within the two 18 months cycles, would it double from 32 to 64 in the first cycle and then 64 to 96 in the second cycle? Or would it be 32 to 128 in the two cycles?

In 18 months it doubles 32 times 2 = 64...In another 18 months it doubles again 64 times 2 = 128...I believe the answer is 128...Somebody correct me if I'm wrong Not A TA
Correct, it doubles every 18 months, so it would go from 32 to 64 and then 64 to 128. Thanks! Brittany Duncan

what's a "tuple" in the setPosition question from the OO problems?
A "tuple" is basically a list with only two entries. Thanks! Brittany Duncan

You said in the review that we wouldn't need to know how to write a program to get information from a website (just to know generally how it works), but for in the review questions, you ask us to write a program to do just that. Will we have to know this or not?
You won't have to do it, but what better way to understand how a program works than to write it? Thanks! Brittany Duncan

By the way, I think this review is the best yet! It's really helpful!
Thanks! Brittany Duncan

why is the traveling salesperson impossible to solve in practice


You might try your book for answers. ;-) Thanks! Brittany Duncan

in the recursion questions:
"Write a function that adds a list of numbers."
are we suppose to use recursion in this function? doesn't a for-loop do this much easier?
Neither a for loop, nor recursion, are particularly hard to implement for this solution (though a for loop may seem easier, because you've had far greater exposure to it then you have recursion). But yes, you're intended to use a recursive solution. There are times when solving a problem is far easier to do recursively, and other times, far easier to do iteratively (with a loop), and times when it's about even. But this test is over recursion, so...be prepared for recursion. Chris Phillips

in this cause the book suggests using the reduce() function
so would the answer be?:
def listSum(list):
  reduce(add,list)

def add(a,b):
  return a+b





No, we haven't taught the reduce function, so we would expect you to do it by using your knowledge of lists and recursion. Thanks! Brittany Duncan

this wasnt really answered.."At most, how many copies of downUp are running at once with the input 'Hello'"
would it be 4? One for hello,ello,llo,lo ?

or would it be 3 since "hello" is just printed separately from the downUp function

5 - hello, ello, llo, lo, o

Just to clarify this a little - I see the cause for confusion, but let's just say that when we call downUp("Hello") from the command line, that is another instance of the function. -Buck Scharfnorth




Link to this Page