Sample Midterm

Sample Midterm - ECS 10 Concepts of Computation Sample...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECS 10 Concepts of Computation Sample Midterm 2 Fall 2008 Multiple choice: Fill in the bubble corresponding to the correct answer on the Scantron form. Choose only ONE correct answer for each of the multiple choice questions. None of the questions is intended to have more than one right answer. If two or more answers are filled in, you will get no credit. There is no penalty for wrong answers, so it is better to guess than to leave the problem blank. Always fill in one bubble. 1. Here is a program with a blank in it. inStr = "rock" for ____________________ print x It prints: r o c k The blank could be filled by... a) x in inStr: b) x in range(inStr): c) x in range(len(inStr)): 2. This program has a missing line. L = for i in range(3): _______________________ print L It prints a list of lists: [[0],[1],[2]] The missing line should be: a) L = L + i b) L = L + [i] c) L = L + [[i]] 1 3. Here is a little program that uses a dictionary to let the user enter and organize a basketball squad. The user enters the names of five players, and then picks one of the five as the center. print "Your fantasy basketball team!" team = {} for i in range(5): player = raw_input("Enter the name of a player: ") team[player] = i center = raw_input("Enter the name of the center: ") if ______________________ print "The center is",center else: print center,"is not on the team" There is a blank in the if statement; it should be...statement; it should be....
View Full Document

Page1 / 7

Sample Midterm - ECS 10 Concepts of Computation Sample...

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

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