|Welcome to CS1315. Click on the python to add comments.|
|This page removed for FERPA compliance|
Fall 2005 Final Exam Review
The review below is not to be considered a practice test, but a guide/reminder for what sort of subjects will appear on the final. You should study the homeworks, previous midterms, lecture slides, the book, etc. too. Anything we've done this semester is fair game.
...and once again, blue questions are significantly harder. If you can solve those, then you know you're in good shape. Just remember that they're only there to pick your brain and re-enforce what you already know. Don't consider them mandatory to know for the final.
Each question here has a corresponding Q/A page that you may post questions to. Feel free to answer other students' questions if you know the answer. Don't expect an answer from TA's instantaneously, especially if you post in the wee hours of the morning. We have finals too. In addition to these questions, you may find the Spring 2005 Final Exam Review helpful also, but don't bother posting to the question pages on there, since those things are ancient. Hit up a TA on AIM/e-mail/office-hours instead.
|Since the question pages will still be active after the Tuesday people take their exam and more information would be given out, I went ahead and summed up everything that the questions pages were saying and/or were about to say just to be fair to everyone. Fall 2005 Exam Review Answers However if you still want further clarification, feel free to post on the question pages. |
Conceptual Questions about Jython You Really Ought to Know
- What does def LITERALLY do?
- Why is return different from print?
- How does the string "1" differ from a numerical 1?
- What are objects?
- Can for loops always be re-written as while loops?
- Can while loops always be re-written as for loops?
Fall 2005 Final Review - Jython Stuff
If you forget everything else we've taught you, you should at least know...
- Why do we write programs?
- When wouldn't you write a program
- Did a bunch of crazy CS TA's get together and invent Python merely for the purpose of entertaining 1315 Students?
- Did a bunch of crazy CS TA's get together and invent JES merely for the purpose of entertaining 1315 Students?
Fall 2005 Final Review - If you forget everything else...
Other short answer questions that didn't seem to fit anywhere else...
- What is RAM?
- How is RAM different from your hard drive?
- What is the minimum sampling rate needed to play a 3000 Hz sound?
- What is a function? What is a method? How are they different? Is one term a subset of the other?
- Write a function that takes in a picture and does something to each pixel. That's right, CS is creative. Do anything you want to the pixel.
- Now take your function from the previous part and modify it so that it only modifies everything that's at least 20 pixels away from the edges (Hint: use ranges)
- Now take that function and modify it so that it only modifies the pixels that are within 100 pixels of the top-left corner (Hint: use the distance formula and an if statement)
Fall 2005 Final Review - Pixel Iterating
- Write a function that takes in a picture and flips the whole thing horizontally
- Write a function that takes in a picture and flips the whole thing vertically (Don't write a new function, just modify your code from the previous problem)
- Write a function that takes in a picture and flips the top half of the picture vertically and the bottom half horizontally.
Fall 2005 Final Review - Flipping pictures
My compliments to the chef
You are given a file that represents daily specials at a restaurant. The file's format is dollar sign, number, slash, menu item, slash, days of the week, slash, special notes, and an exclamation mark. An excerpt from the file might look like this:
|$12.50/Baked Salmon/Monday, WeREMOVEDsday/includes dessert!|
$7.90/Garden Burger/Monday, Tuesday, WeREMOVEDsday, Thursday/includes soda!
$5.50/Grilled Cheese/Thursday, Friday/includes chips!
Write a function called specials that will take a day (in the form of a string) as a parameter. If that day is found on a line in the daily specials file, print the entire line. You only have to display one matching line, even if there are several. If the day is not found, print "No specials today."
As an example, if you were to call specials("Friday") using the example above, you should see:
$5.50/Grilled Cheese/Thursday, Friday/includes chips!
Fall 2005 Final Review - My compliments to the chef
The New York Times
4. The X in XML stands for this.
7. Typically this is the first part of an HTML file that tells you the version or type of HTML encoding of the file.
10. Although HTML is a language, it is not a __________ language.
11. #0000FF is a color code for ______.
1. The term "Picture Element" is often abbreviated as _____.
2. When discussing Object Oriented programming, objects that have been created are known as an _________ of a class.
3. ________ is often used for encoding colors for use in HTML.
5. This is the most fundamental unit of memory. It can either be a 0 or a 1.
6. When writing HTML, if you want to skip to the next line you usually either use a break tag or a _________ tag.
8. To access web pages from within your JES code, you normally would import that ________ module.
9. The M in HTML and XML stands for ________.
- Write a function that takes in a directory and outputs 100 frames to that directory called "frame00.jpg", "frame01.jpg", ..., "frame99.jpg". The movie is just a 50 pixel by 50 pixel picture that steadily fades from black to lime green over the course of the 100 frames. Hint: determine the color in terms of the frame number.
- Write a function that makes a movie (100 frames, takes in a directory, you know the routine by now). The frames should be 100 pixels by 100 pixels with a black background and have a single white pixel that travels from the bottom left corner to the top right corner over the course of the 100 frames. Hint: think of drawing a pixel as drawing a rectangle with width and height of 1. This is also very much like the tickertape problems.
Fall 2005 Final Review - Movies
HTML meets the Back Cover of Highlights Magazine
How many errors are in this chunk of code?
<p>This is my first paragraph
<p>This is my second paragraph
Thank you for visiting
<a href="OMGhelpMe@html.com">Send me comments!</a>
How would you fix this?
Fall 2005 Final Review - HTML ICU
Writing HTML from Scratch
Place appropriate HTML tags on the following text to generate a similar to what is shown below.
Welcome to My REMOVED!
It's all about me
This is a page about how I love JES!
click on the picture to know even MORE about JES!
Click to enlarge
Fall 2005 Final Review - Writing HTML
import os Magic
- Write a function that takes in a directory. The function will print out the following information:
- How many pictures (.gif, .jpg, .png, .bmp) are in the directory.
- How many text documents (.txt, .rtf, .doc) are in the directory.
- How many python files(.py) are in the directory.
>>> yeehaw(r"C:\documents and settings\Blake O'Hare\Desktop")
Text Documents: 9375390
Python Files: 20035
- Extra cool points: Write a function called avgFileSize that takes in a directory and returns the average file size in terms of Megabytes. (Yes, we've taught you everything you need to know to be able to do this. You'll just have to twist it in a way we haven't explicitly shown you.)
Fall 2005 Final Review - import os Magic
Consider the following phone book stored in a file called "talkybanana.txt" in your JES folder:
- Write a function called getEntry that takes in a name and returns the phone number
- Write a function called addEntry that takes in a name and a phone number and adds it to the file
- Write a function called deleteEntry that takes in a name and deletes it from the file.
Fall 2005 Final Review - Only 1 Phone Number is Fake
Homework 5 Jr.
<li>Scientists link donuts with obesity.</li>
<li>GT students are the happiest according to Princeton Review.</li>
<li>Microsoft goes open source.</li>
Suppose this page could be found at http://www.blake.com/news.html. Write a function that goes to this page and returns a list of all the headlines.
- Write a function called flipLeft that takes in a sound and reverses the first half only.
- Write a function called fadeAway that takes in a 22kHz sound and fades the last second to silence. You can assume that the sound passed in will be more than 1 second in length.
Fall 2005 Final Review - BEEP BEEP
Using recursion, write a function for each of these...
- reverses a string
- finds the length of a string
- converts a string to uppercase
- sums the numbers in a list
- decreases the red in a picture (Hint: getPixels gives you a list of pixels)
Fall 2005 Final Review - Recursion
Briefly discuss the following...
What is a...
Fall 2005 Final Review - t3h Intarw3b!!!1