Final Exam Review- Fall 2007
The following sections are organized by learning objectives and contain sample questions, many of which are from earlier tests. You can also look at the questions in the corresponding chapters of the textbook for ideas about questions that may come up on the final. Previous semesters' tests and reviews are also a good source of questions (see Hotspots #3), but in some cases, we cover different details in different semester offerings of the course, so don't worry if you find a concept referred to on a previous semester's test that you don't recognize. The questions below should all assess knowledge and skills from this semester.
Be able to explain the concept of encoding of data. For example
- colors as triples of values 0..255
- sounds as samples with values -16k..16k
- characters as Unicode numbers (You don't have to know any Unicode values, just that they exist.)
- document structure as HTML tags
EXAMPLE QUESTION: The maximum value that can be represented by a byte is....
Python programming mechanics. Explain the JES editor and command areas.
EXAMPLE QUESTION: If you type the following into the command area of JES, what will be printed on the line below?
(a) 5.0/2
(b) 5/2
(c) getHeight(makeEmptyPicture(640, 480))
(d) distance(green, green)
(e) distance(black, blue)
(f) range(0, 3)
EXAMPLE QUESTION: Please write what would be printed if you typed the follwing in the JES command area.
a) 13 / 2
b) 2 1
c) 2 == 2
d) 1 == "1"
e) 13 % 2
Control structures. Be able to write and trace code that includes the following basic control structures:
- for and while loops
- if, elif and else conditions
- break
EXAMPLE QUESTION: Consider this code and fill in the blanks below:
for x in range(0,1000):
print x # First command
print x #Second command
(a) The number of times the first print command is executed: ...........
(b) The number of times the second print command is executed: ..........
EXAMPLE QUESTION: Change this program, which calculates your test average
def testAverage(tests):
testTotal = 0
for testScore in tests:
testTotal = testTotal + testScore
return testTotal / len(tests)
to the new way of calculating your test average. The new algorithm has your final exam score replace your lowest test score, but only if your final score is higher.
def revisedTestAverage(tests, final):
testTotal = 0
...
for testScore in tests:
...
testTotal = testTotal + testScore
if ...:
testTotal = ...
return testTotal / len(tests)
Functions. Be able to write and trace functions that take parameters and produce output or return values. Understand scope rules (when a variable is defined and can be referred to without generating an error).
EXAMPLE QUESTION:
(a) In the Wedding example, what is printed when you type marry ("Bill", "Hilary"). What is printed when you type marry("Hilary", "Bill")?
(b) In the Wedding example, what is printed when you type marry (husband, wife) in the command area. (Assume that you have just started JES and have loaded the function but done nothing else). Why do you get this result?
(c) Modify the Wedding code so that it prevents a person from marrying himself or herself.
EXAMPLE QUESTION: 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.
Understand encoding of pictures and colors. Be able to encode white, black and primary and secondary colors as RGB triples and match color names to triples. Explain the consequences of attempting to assign out-of-range values to colors.
EXAMPLE QUESTION: How many bytes are used to represent an RGB color?
EXAMPLE QUESTION: What is the maximum value that can be represented in a byte (e.g. a red, green or blue value)?
EXAMPLE QUESTION: Complete the following to make a shade of gray:shadeOfGray = makeColor(200, 200, _____)
EXAMPLE QUESTION: Which is which?
| Yellow | (255, 255, 255) |
| White | (0, 0, 0) |
| Dark blue | (0, 0, 64) |
| Black | (255, 255, 0) |
EXAMPLE QUESTION: Given the default behavior of JES, if you do the following, what will be printed if you type the following in the command area?
setGreen(pixel, 256)
print getGreen(pixel)
EXAMPLE QUESTION: If pic has dimensions 400x200, how many pixels does pic contain?
EXAMPLE QUESTION: Given the code below and the same picture (pic) as in the previous question,
1 def change(pic):
2 newValue = 255
3 for p in getPixels(pic):
4 setRed(p, newValue)
(a) How many times is line number 4 executed when you enter the command "change(pic)" in the command area?
(b) How many times is line number 2 executed?
(c) If you had another picture called pic2, would typing change(pic2) in the command area instead of change(pic) give you an error message?
(d) After you run the change function on a picture, would you get an error message if you then typed newValue or would you get the value 255?
Picture functions. Be able to use and explain getPixels, color functions (makeColor, getColor, getRed, setRed, getGreen, setGreen, getBlue, setBlue), pixel locations (getPixel, getX, getY), picture properties (getWidth, getHeight), picture I/O (makePicture, makeEmptyPicture, writePictureTo).
EXAMPLE QUESTION: Start with the function whiteSpot on the page whiteSpot and yellowDottedLine. Write a function that puts a black spot at the center of a blank white canvas.
EXAMPLE QUESTION: Start with the function yellowDottedLine on the page whiteSpot and yellowDottedLine. Write a function that draws a dotted line consisting of blue pixels with a two pixel gap between them. The line should start at the center of a blank picture and extend for 100 pixels to the right.
Ability to write and trace code that transforms pictures by transforming every pixel (e.g. darkening or lightening a picture, increasing or decreasing one color channel, making photographic negatives) or by combining pixel values (e.g. grayscale or sepia toning), or by compressing the color space (i.e. posterizing).
EXAMPLE QUESTION: Start with the template function transformPicture() on the page Code for transforming pictures. Write the line or lines of code that replace the pass in order to
(a) make a blue channel image (i.e. by zeroing the R and G).
(b) make a orange color negative (i.e. so that it looks like a film color negative). Use a color shift of R+100, G+50 after you have negated the pixel.
(c) make a bitmap (i.e. a black and white posterization, in which a pixel is white if the average pixel value is > 127 or black if it is lower.)
EXAMPLE QUESTION: The Make Sunset question on Test 1 Review- Fall 2007
EXAMPLE QUESTION: Start with the Monochrome function and make a monochrome negative.
EXAMPLE QUESTION: Write a function from scratch that calls Monochrome to make a monochrome negative.
EXAMPLE QUESTION: The Greyscale question on Test 1 Review- Fall 2007
EXAMPLE QUESTION: The Which Does Which? question on Test 1 Review- Fall 2007
EXAMPLE QUESTION: The Generalized Color Changing and Generalized Image Filter questions on Test 1 Review- Fall 2007
EXAMPLE QUESTION: The Check Your Luminance question on Test 1 Review- Fall 2007
EXAMPLE QUESTION: What are the effects on pic of running the following functions? Do not refer to pixels in your answer. Instead, use a word or phrase that describes the overall effect on the picture.
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))
def mystery3(pic):
for pix in getPixels(pic):
mysteryQuantity = (getRed(pix)+getGreen(pix)getBlue(pix))/3
setRed(currentPixel, mysteryQuantity)
setGreen(currentPixel, mysteryQuantity)
setBlue(currentPixel, mysteryQuantity)
EXAMPLE QUESTION: One form of color blindness is red-green color- blindness. Create a program that generates something like what it's like to see with red-green color-blindness. Write a function redGreenOut which takes a picture as input. For each pixel, set the red and the green values of that pixel to the average of the red and green values. (Hint: You may find mystery3 above a useful starting point for writing code).
EXAMPLE QUESTION: Imagine that you have a tiny picture consisting of just four pixels whose (red, green, blue) values are these:
(10,5,128) (100,0,128)
(2,2,128) (10,10,120)
What will be the (red, green, blue) values in those pixels after running this program?
def cryptic(picture):
for p in getPixels(picture):
redVal=getRed(p)
greenVal=getGreen(p)
blueVal=getBlue(p)
newColor=makeColor( redVal/2, blueVal, 64-greenVal)
setColor(p,newColor)
Selective manipulation of picture areas. Be able to combine knowledge of pixel manipulations with selective testing of x,y locations. Revise your collage homework so that you understand how to copy a picture onto another picture.
EXAMPLE QUESTION: Using the darken and negate functions on the page Code for transforming pictures, write a function that darkens the top left and bottom right quadrants of a picture and negates the other two quadrants.
EXAMPLE QUESTION: Having solved the previous question, write a function that copies your modified picture onto an empty canvas of the same size and returns the modified picture.
Explain the principles behind chromakey (i.e. green screening or blue screening) and common media applications.
EXAMPLE QUESTION: When a weather forecast is produced using chromakey, with the meteorologist standing in front of a green screen, what would happen if the meteorologist wore green clothes?
EXAMPLE QUESTION: Below is the code that we discussed in class to illustrate chromakey:
def testChromakey():
colbertFile = getMediaPath("colbert-greenscreen.jpg")
colbertPic = makePicture(colbertFile)
weatherFile = getMediaPath("Weather_map.jpg")
weatherPic = makePicture(weatherFile)
show(weatherPic)
bgColor = makeColor(80, 180, 80)
chromakey(colbertPic, weatherPic, bgColor)
repaint(weatherPic)
def chromakey(fgPic, bgPic, refColor):
threshold = 120
offset = getHeight(bgPic) - getHeight(fgPic)
for fgPixel in getPixels(fgPic):
if distance(getColor(fgPixel), refColor) > threshold:
x = getX(fgPixel)
y = getY(fgPixel)
bgPixel = getPixel(bgPic, x , y + offset)
setColor(bgPixel, getColor(fgPixel))
(a) Describe what happens to weatherPic if you reduce the value of threshold:
(b) Describe what happens to weatherPic if you increase the value of threshold:
(c) Given that this program has the desired effect, why is bgColor defined as having the RGB values (80, 180, 80)? Where do these numbers come from?
EXAMPLE QUESTION: The Mangle question on Test 1 Review- Fall 2007
EXAMPLE QUESTION: The Descriptions question on Test 1 Review- Fall 2007
Use and trace graphics functions.
EXAMPLE QUESTION: Write two functions that draw a square with its top-left corner at the center of a canvas. The sides of the square should be 100 pixels long. For the first function, use the JES drawLine function to draw the sides. For the second, use turtle functions to draw the square.
EXAMPLE QUESTION: You try to write some text at the top left of a picture by typing
drawText(picture, 0, 0, "Hello World")
repaint(picture)
but no text is displayed in the picture. Why not?
Understand basic psychophysics of movies (e.g. frame rate required for motion perception) and workflow for generating movies (i.e. JES, MovieMaker, Quicktime, etc.)
EXAMPLE QUESTION: What are the inputs and the outputs of the MovieMaker tool?
EXAMPLE QUESTION: The earliest movies were shown at 16 f.p.s. (frames per second). Why do current movies, videos and video games have faster frame rates?
EXAMPLE QUESTION: In the Sunset movie, we reduced the blue and green in each pixel on each frame. Why didn't we just increase the red value?
EXAMPLE QUESTION: In what year was the game Pong first introduced?
(Just kidding. The answer is 1972 - 35 years ago this week, in fact.)
EXAMPLE QUESTION: The Moving Rectangle Goes to Right and Stays There example has that name because that's what it does. Can you figure out the problem that stumped me in class back in September? Make the bouncing ball really bounce back. (The answer is posted on the slides/code page. No question like this will be on the test, but answering it is a good way to consolidate your understanding of frame numbers, pixel coordinates, and their relationship in animation.)
EXAMPLE QUESTION: In the Moving Rectangle Bounces Left-to-Right animation, a new canvas is created at the beginning of the for loop's indented block of code. This seems rather inefficient. Can't we just move that line of code up before the for loop (and unindent it, of course)? What would the animation look like if we did that?
EXAMPLE QUESTION: Consider the code given below, and sketch the frames that are produced when the code is run using the following call. Sketch what is displayed in each frame. (Don’t worry too much about exact accuracy in sizes and positions. Just bear in mind that 25 is one quarter of 100.):
makeTestMovie()
You can assume that writeFrame() is defined to write the frame into an appropriately named and numbered JPG file.
def makeTestMovie():
for frameNumber in range(1,5):
frame = makeEmptyPicture(100, 100)
x = 25 * (4 - frameNumber)
y = 25 * (frameNumber – 1)
addRectFilled(frame, x, y, 25, 25, black)
writeFrame(frame, frameNumber)
EXAMPLE QUESTION: Answer the questions based on the function below.
1 def mystery():
2 width = 10
3 rate = 20
4 canvasWidth = 200
5 canvasHeight = 100
6 x = 1
7 y = canvasHeight/2
8 for frameNumber in range(1, 21):
9 canvas = makeEmptyPicture(canvasWidth, canvasHeight)
10 if (frameNumber * rate + 10) < getWidth(canvas):
11 addRectFilled(canvas, x, y, width, width, orange)
12 x = x + rate
13 else:
14 print "Yay"
15 addRectFilled(canvas, x, y, width, width, orange)
16 x = x - rate
17 writeFrame(canvas, frameNumber)
1) When do the frames get written? (Select ONE):
a. All of them get written at the end.
b. One is written each time the program goes through the loop.
c. They don’t get written at all.
d. Only one frame ever gets written: the last one.
2) Assuming that all the frames get written correctly, what does the movie show? (Select ONE):
a. A moving orange square
b. An orange line that grows longer
c. An orange square that grows in size
d. A checkerboard of orange squares
3) How many times does the “if” (line 10) get evaluated?
4) How many times does the block under the “else” (lines 14-15) get executed?
Explain how to use small pictures as sprites in an animation in conjunction with the mod function. You should look at your movie homework code to reinforce your understanding of what you did way back then.
Sound functions. Be able to use and explain getSamples, getSample, getSampleValueAt, setSample, setSampleValueAt, sound properties
(getSamplingRate, getLength), sound I/O (makeSound, makeEmptySound, writeSoundTo).
Demonstrate understanding of sound encoding and auditory psychophysics as it relates to computation of sound.
EXAMPLE QUESTION: The smallest “slices” of a digitized sound are called
A Sounds
B Pixels
C Tinkles
D Samples
EXAMPLE QUESTION: How many distinct sound values can a sample have when using the sound encoding that we have been using?
A. 256
B. 2^16
C. 10
D. 11
EXAMPLE QUESTION: Given that a sound is encoded as a sequence of two-byte samples, what is the range of values that a sample can have? (The abbreviation "k" means "1,024")
(a) -11..+10
(b) -128..+127
(c) -256..+255
(d) -32k..+32k-1
(e) -64k..+64k-1
EXAMPLE QUESTION: Nyquist’s theorem says that the sampling rate needs to be
A . At least twice the highest frequency in the sound
B. At least half the highest frequency in the sound
C. The same as the highest frequency in the sound
D. 440Hz
EXAMPLE QUESTION: According to Nyquist's Theorem, what is the minimum (i.e. slowest) sampling rate that can be used to represent sounds adequately that contain frequencies up to 16kHz?
(a) 16 frames per second
(b) 8,000 samples per second
(c) 16,000 frames per second
(d) 32,000 samples per second
(e) about 44,000 samples per second
EXAMPLE QUESTION: If you digitized a recording of a mobile telephone conversation and a group of live musicians in a recording studio
(a) Which would require a greater (i.e. faster) sampling rate for
accurate reproduction?
(i) The phone call
(ii) The music recording
(b) Why?
EXAMPLE QUESTION: Given that a sound is encoded as a sequence of two-byte samples, what is the range of values that a sample can have? (The abbreviation "k" means "1,024")
(a) -11..+10
(b) -128..+127
(c) -256..+255
(d) -32k..+32k-1
(e) -64k..+64k-1
EXAMPLE QUESTION:
(a) The sounds in the mediasources directory are all two-byte WAV files. State the maximum and minimum sample values for such a sound. (You can give a value to the nearest thousand.)
(b) 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? (Hint: Answer is not ±11)
(c) What is clipping?
EXAMPLE QUESTION: When we normalize a sound, we make it louder, but we have to be careful not to make it too loud. Explain in English the algorithm for normalizing a sound (Hint: It contains two loops, one after the other).
EXAMPLE QUESTION: Here is a code template for doing something to a sound:
def loopThroughSound1(sound):
for s in getSamples(sound):
pass
Suppose that there is a bug in the implementation of getSamples() so that you cannot use it. (In an earlier version of JES this was true.) Rewrite the code template using another way to go through all the samples in the sound. You can assume that getSample() still works correctly.
EXAMPLE QUESTION: The blend function on the Adding two sounds and removing noise from a signal page adds two sounds together. Assuming that s1 and s2 are two sounds What is the difference between (a) and (b) below?
(a)
blend(s1, s2)
play(s1)
(b)
play(s1)
play(s2)
(Hint: What you hear in the two cases is identical, so that's not the difference.)
EXAMPLE QUESTION: White noise is the hissing sound that is often introduced into a recording by equipment, electrical conditions, etc. We can simulate the introduction of white noise into a digitized sound by changing its sample values by random amounts.
Write a short function called makeNoisy that takes a sound as its input and modifies the sound by adding a random amount to every sample. The noise should vary randomly between -500 and +500 in value. Don't worry about the noise causing clipping. Just let that happen (this is noise, after all). You can start from the template below and fill in the details.
import
def makeNoisy( ):
for in :
Lists. Be familiar with list notation and list functions, and the way in which lists interact with for loops (e.g. using range, getPixels, etc.). Don't get confused by nested lists: lists can contain other lists.
Text string functions, methods and the concatenation operator. Be able to use and explain the "+" operator for strings, the function len and the methods find, rfind and append.
Modules. Show that you understand what modules are, their role in dot notation, and the need to import. Familiarity with the modules time (functions time, ctime and sleep), random (functions random, randrange, choice) and os (function listdir and constant sep).
EXAMPLE QUESTION: Here is a function that censors text strings containing references to the University of Georgia.
1 def censor(ugaString):
2 newString = ugaString
3 wordPairs = [["red", "gold"], ["dog", "jacket"], ["Athens", "Atlanta"]]
4 for wordPair in wordPairs:
5 position = newString.find(wordPair[0])
6 if position != 0:
7 next = position + len(wordPair[0])
8 newString = newString[0: position] + wordPair[1] + newString [next:]
9 return newString
(a) Suppose we execute the following three lines in the command area of JES:
s1 = 'Our campus is in Athens. Our colors are red and black. Go dogs!'
s2 = censor(s1)
print s2
What is printed?
(b) The variable wordPairs is a list. How many elements does it contain?
(i) 0
(ii) 2
(iii) 3
(iv) 6
(c) Suppose the code is running and is executing for loop for the first time. When it gets to line 8, what is the value of len(wordPair [1])?
(i) 0
(ii) 2
(iii) 3
(iv) 4
(d) In line 5, position is
(i) A true or false value (0 or 1)
(ii) An integer
(iii) A string
(e) In line 5, newString is the name of a
(i) module
(ii) string variable
(iii) method
(f) In line 5, find is the name of a
(i) method
(ii) function
(iii) argument
EXAMPLE QUESTION: Write a function that checks whether two strings are equal and returns 1 if they are and 0 if they are not. The function should have the following definition line:
def check(string1, string2):
EXAMPLE QUESTION: Write a function that checks whether two strings have equal lengths and returns 1 if they have and 0 if they have not. The function should have the following definition line:
def check2(string1, string2):
EXAMPLE QUESTION: Write a function that decides whether a string is a palindrome and returns 1 if it is and 0 if it is not. A palindrome is a string which is the same in both directions. The function should have the following definition line:
def palindrome(string1):
So palindrome("notlob") should return 0 and palindrome ("ablewasiereisawelba") should return 1.
Eliza and some CS history
EXAMPLE QUESTION: The Turing Test does or will allow us to
(a) Determine whether a program that contains while loops will ever finish running,
(b) Say whether a program that we are interacting with is intelligent,
(c) Tell whether an HTML document will display correctly in both Internet Explorer and Apple Safari,
(d) Find the sampling rate of a sound.
EXAMPLE QUESTION: Eliza is a simulation of what type of professional?
(a) football coach
(b) psychotherapist
(c) car mechanic
(d) CS professor
Be able to write simple HTML pages using basic tags such as H1, UL, OL, LI, TABLE and the table tags. Demonstrate an understanding of HTML and its relation to other web languages (CSS, Javascript).
EXAMPLE QUESTION: HTML is mainly for marking up a document with logical tags. To control the layout and physical appearance of a web page, the best language to use is
(a) CSS
(b) Javascript
(c) Matlab
(d) Python
EXAMPLE QUESTION:
(a) Normally, what would be displayed in blue and underlined in the following text?
<BODY>
<P>This is a fragment of HTML.
<A HREF="anotherPage.html">My favorite colors</A> are navy and gold.
</BODY>
(b) What does this color and underlining indicate to a user?
EXAMPLE QUESTION: Match the following logical document elements with their HTML tags.
| (a) Table | <A> |
| (b) Link | <H1> |
| (c) Paragraph | <IMG> |
| (d) Major heading | <ITEM> |
| (e) A row in a table | <LI> |
| (f) A bulleted list | <OL> |
| (g) An item in a list | <P> |
| (h) A picture | <TABLE> |
| | <TR> |
| | <UL> |
You should be comfortable writing and reading code that manipulates (reads and edits) web pages - e.g. the class demonstration featuring the AJC weather page.
Exhibit knowledge of how HTML works, the difference between servers and clients, the meaning of the parts of a URL, etc., the fact that a page doesn't change after it is generated unless it contains Javascript.
EXAMPLE QUESTION: Which of the following programs is a network client?
(i) Word processor
(ii) Email program
(iii) JES
(iv) MovieMaker
(v) Web browser
(vi) Powerpoint
EXAMPLE QUESTION: Explain why one of the dates on the page http://coweb.cc.gatech.edu/cs1315/uploads/5085/js.html is the same whenever the page is viewed but the other date changes.
Ability to program using turtle graphics (using both function and method notation when both are available). This includes making the world, making turtles, moving them forward and backward, turning them through right angles and arbitrary angles, setting the pen up and down. You should be able to recognize some of the other methods,
although you don't need to memorize them (e.g. to change the body and shell colors, move to a specific location, etc.) You should be able to draw simple regular shapes and be able to sketch the path left by a turtle program.
EXAMPLE QUESTION: Draw the track left by the turtle in the following program. You do not need to draw it perfectly to scale, but show the final position and direction of the turtle.
def mystery():
world = makeWorld(500, 500)
turtle = makeTurtle(world)
penUp(turtle)
moveTo(turtle, 0, 0)
turnToFace(turtle, 500, 500)
penDown(turtle)
forward(turtle, 500)
for i in range(4):
turnLeft(turtle)
forward(turtle, 50)
for i in range(3):
turnRight(turtle)
forward(turtle, 50)
EXAMPLE QUESTION: Below is a program that has a turtle draw a square with sides of a specified length s.
def square(turtle, s):
for side in range(4):
forward(turtle, s)
turn(turtle, 90)
Using the above code as a starting point, write a program that has a turtle draw a regular polygon with n sides of length s. (Hint: The turtle will have turned through 360 degrees by the time it finishes and will have turned n times.)
Object-oriented concepts. Understand the difference classes and objects and between defining a subclass (Dachshund being a subclass of Dog) and creating an instance (charlie being my new Dachshund). Be able to write simple programs that include class and method definitions, create instances, and invoke methods that are defined in the class. You don't need to write constructors, but you need to be able to use them to create instances.
EXAMPLE QUESTION: The following program defines a set of animals.
class Reptile:
def describe(self):
print "I am a reptile"
class Dinosaur(Reptile):
def describe(self):
print "I am extinct"
class Python(Reptile):
def makeNoise(self):
print "hiss"
(a) To create a python called monty, what would you type in the JES command area?
(b) Suppose you have python called monty and a dinosaur called barney, what is printed in the command area if you type the following commands? (If an error is generated, just write ERROR).
(i) describe(monty)
(ii) monty.describe()
(iii) monty.makeNoise()
(iv) barney.describe()
(v) barney.makeNoise()
(vi) monty == barney
Recursive functions. You should be able to write simple recursive definitions for functions like factorial and answer questions about the recursive calls. Clarify when recursion is a better idea than looping (Hint: trees).
EXAMPLE QUESTION: In the following recursive function
def factorial(number):
if number=0:
return 1
else:
return number* factorial(number-1)
(a) Label with an arrow the line or lines of code that constitute the base case.
(b) If the base case were removed so that only the recursive case remained, what would happen to the program when it ran? (Assume that the removal is done correctly and that the resulting program is syntactically valid.)
(c) Underline the recursive call in the code above.
Speed of execution. Know what factors can influence the execution speed of a program. In particular, what is the difference between a high-level programming language and machine language, and what are compilation and interpretation? How do Python (specifically Jython), Java and C++ relate to these concepts? Be able to explain why the binary search algorithm is faster than sequential search and why the traveling salesman problem is intractable.
EXAMPLE QUESTION: Make the following text correct by filling in the blanks and circling the correct choices.
For a program written in a high-level programming language like Python to execute, it has to be translated into
------------------------ for that type of computer. This translation process can occur in two ways. __________________
occurs when the whole program is translated in one operation and then executed. __________________ is when the program
is translated a statement or line at a time and that part of the program is executed. The [first/second] of these
approaches results in programs that run faster. Python is an example of the [first/second] approach. In Jython, which
we are using in this course, Python is first translated into __________.
EXAMPLE QUESTION: Java is processed by
(a) An interpreter
(b) A compiler
(c) Both
(d) An espresso machine
EXAMPLE QUESTION: Which of the following will affect the speed of a program? (Check all that apply.)
(a) Hardware
(b) Programming language
(c) Algorithmic complexity
(d) Octane content
EXAMPLE QUESTION: The number of steps that the traveling salesman problem must execute for N cities is proportional to
(a) N
(b) N*N
(c) log(N)
(d) N!
EXAMPLE QUESTION: Machine language is
(a) The same for all computers
(b) Unique to a particular type of computer
(c) For a fictitious computer
(d) What Eliza speaks
Unimedia and databases. What is an encoding? How is text used as an interchange format for programs that handle media such as sounds and pictures? Visualizing sounds as a pictures, using a spreadsheet as an intermediary representation. Explain the role of XML and SQL in the storage and retrieval of data. Explain the difference between a file or files and a database.
EXAMPLE QUESTION: What do the following abbreviations stand for?
(a) XML
(b) DBMS
(c) SQL
EXAMPLE QUESTION: In the context of a database query, what is a join?
EXAMPLE QUESTION: Databases are fast because of
(a) Compilation
(b) Indexing
(c) Hashing
(d) Slashing
EXAMPLE QUESTION:
The software that controls a database is
(a) A DNS Server
(b) An Operating system
(c) TSquare
(d) A DBMS
EXAMPLE QUESTION:
The standard language for updating & querying databases is
(a) HTML
(b) SUQL
(c) SQL
(d) WOBL
Questions?
Link to this Page
- Hotspots #3 last edited on 5 May 2008 at 10:40 am by c-76-17-124-0.hsd1.ga.comcast.net