Introduction to Computer Science Exam 2 Review

advertisement
Introduction to Computer Science
Exam 2 Review
The following top list includes covers the areas that you should study/review/practice before the
exam. It only includes the topics we discussed since the last exam. Previous python knowledge
is of course still required.
YOU MAY BRING A STUDY SHEET TO THE EXAM (8 1/2 by 11 in) BOTH SIDES
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
We looked at several 2D image file formats which include (.bmp, png, jpg, and gif) Review
the basic attributes of these formats such as relative storage size, colors that they can
represent, whether or not they are compressed and uses. What is image resolution? Lossy
and Lossless?
What is the different between raster graphics and vector graphics and their applications.
Which do the programs Paint.net and Inkscape work with?
What is RGBA? What color is represent by the following (0,0,0),(128,128,128),(256,256,256)
and (256,0,0).
What about formats such as rtf, pdf, svg and ps?
What is pixelating? How can it be corrected?
We used Paint.net to work on images and looked at some attributes of the program. Give a
list of things we can do to images. What is special about layers. When you save a multilayer
image in Paint.net as a png or jpg file what happens with the layering?
Python Iteration
Review the meaning of the operators / and % . What is returned when do something like
45%5 or 2/3. How about 2/3.0?
We discussed two ways to write loops in Python, the for loop and the while loop. Review the
chapter 7 PowerPoint and associated chapter carefully. I will ask you to write simple loops to
do things like print specific sequence of numbers. What does range(10) generate? Here are a
few examples. Don’t memorize, learn the logic and semantics so you can write things you
have never seen before.
a. Write a loop that prints the following lists using both a while and a for
i. 1,2,3,4,5,6,7,..,100
ii. 2,4,6,8,..40
iii. 55,50,45,40, .. , -50,-55
Interactive Input and strings (chapter 8)
Be able to read in numbers or strings from the keyboard using raw_input().
Be able to read in a string and process it. (ie print its character vertically, determine its length,
count the number of a’s in a dna string etc.
Use a simple for loop to print the characters of a string, forward, backwards etc.
12.
13.
14.
15.
16.
17.
18.
19.
Study string concatenation and string slicing. If s=”I love Python” what is s[2,6] or s[7:] etc
Review the string methods find, isdigit, startswidth, upper
What is the difference between a method and a function. Which is len()?
How are strings compared? IE if a=”hello” and b = ‘there’ what does a<b mean and what is
returned?
Be able to open and read in a text file and search for strings in it. See the examples in the Ch8
ppts page 14.
Study the ppt 20 in the Ch8 ppt. What does it do?
Lists
What is a list in Python? How can we create one? How can be combine and search them?
Review Ch10 ppt we covered in class. Be sure you know how to add a new item to a list, how
to delete items from lists, get the length of a list, slice a list and so on.
Download