rec7 - CS 177 Week 7 Recitation Slides Modifying Sounds...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 177 Week 7 Recitation Slides Modifying Sounds using Loops + Discussion of some Exam Questions
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 ANY QUESTIONS?
Background image of page 2
3 Q3. Consider the following function definition: def sum(a, b): c = a + b return c print “Hello World” What is the output when you execute sum(4,5) from the command window in JES? A) 9 B) Hello World C) 9 Hello World D) There is no output A)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Q5. How many times does the following code print “CS177” ? for i in range(0,5): for j in range(4): print “CS177” print “CS177” A) 20 times B) 21 times C) 30 times D) 31 times B)
Background image of page 4
5 Q9. Consider that the numbers from 1 to 20 are arranged in a two dimensional matrix with 4 rows and 5 columns, filling one row after the other. What are the co-ordinates for the number 14 within the matrix? A) (3, 2) B) (3, 4) C) (2, 3) D) (4, 3) C)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Q11. Assume that we have a picture with width of 300 and height of 50. We want to write a program that scales the picture up by a factor of 4 and then rotates the picture to the left by 90 degrees. Which of the following statements should we use to make the empty picture that will be used by our program? A) newPicture = makeEmptyPicture(200, 1200) B) newPicture = makeEmptyPicture(1200, 200) C) newPicture = makeEmptyPicture(300, 200) D) newPicture = makeEmptyPicture(300, 50) B)
Background image of page 6
7 Q13. Assume that we have a function max(a, b, c, d) that returns the maximum of the given parameters. Which of the following is NOT a legal statement? A) value = max(7, 5, 11, 9) + 10 B) print max(1, 3, 2, 4) C) max(11, 17, 13, 15) D) result = max(4, 2, 3) D)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Q25. Consider the following function: def myFunc(pict): allPixels = getPixels(pict) for p in allPixels: value = getRed(p) setRed(p, value*0.5) What does myFunc function do? A)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2012 for the course CS 177 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 28

rec7 - CS 177 Week 7 Recitation Slides Modifying Sounds...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online