Docsity

Quiz 2 for COSC 235, Fall 2008 by David A. Sykes - Prof. David A. Sykes, Quizzes of Computer Science

Toggle sidebar
bg1
COSC$235,$Fall$2008$ $ David$A.$Sykes$
Name:$_____________________________$ $ Pledged:$_____________________________$
Quiz%2%
Se pte mber (12,(2008(
1. Number$the$activities$below$to$show$he$order$they$occur$in$software$development.$
____$design$ ____$implementation$ ____analysis$ ____$maintenance$ ____$test$and$debug$
2. Circle$the$invalid$identifiers$in$the$list$below.$
Coca‐Cola$ sprite$ Dr.Pepper$ orangeCrush$ Fanta$ 7up$ H2O$ _oHIo_$
3. Some$identifiers$are$part$of$Python$and$have$specific$uses$so$they$can’t$be$used$for$variable$names,$function$
names,$and$the$like.$These$are$called$________________$___________.$
4. Show$the$output$of$the$program$[look$carefully].$
for k in range(3):
print "going,",
print "gone!"
5. Show$the$output$of$the$following$code$segment.$
a = 10
b = 5
t = a * 3
a = b * 2
b = t
print a, b
6. The$equal$sign$used$in$the$first$Python$statement$in$Question$5$is$called$the$_____________________$
operator.$Semantics:$The$expression$on$the$right$side$of$=$is$evaluated$to$produce$a$value$that$is$then$
associated$with$the$variable$named$on$the$left$side.$
$
7. A$loop$that$will$execute$a$definite$number$of$times$is$called$a$____________________$loop.$
8. Show$the$output$of$the$program.$
for k in [ 1, 2, 4 ]:
print k,
print
print "Done!"
9. The$expression$range(4)$is$equivalent$to$writing$________________________________________.$
$
10. Statements,$such$as$for,$are$called$control'structures.$In$ONE$sentence,$explain$the$concept$flow'of'control.$
$
$
$

Partial preview of the text

Download Quiz 2 for COSC 235, Fall 2008 by David A. Sykes - Prof. David A. Sykes and more Quizzes Computer Science in PDF only on Docsity!

COSC 235, Fall 2008 David A. Sykes Name: _____________________________ Pledged: _____________________________

Quiz 2

September 12 , 2008

  1. Number the activities below to show he order they occur in software development. ____ design ____ implementation ____analysis ____ maintenance ____ test and debug
  2. Circle the invalid identifiers in the list below. Coca‐Cola sprite Dr.Pepper orangeCrush Fanta 7up H2O oHIo
  3. Some identifiers are part of Python and have specific uses so they can’t be used for variable names, function names, and the like. These are called ________________ ___________.
  4. Show the output of the program [look carefully]. for k in range(3): print "going,", print "gone!"
  5. Show the output of the following code segment. a = 10 b = 5 t = a * 3 a = b * 2 b = t print a, b
  6. The equal sign used in the first Python statement in Question 5 is called the _____________________ operator. Semantics: The expression on the right side of = is evaluated to produce a value that is then associated with the variable named on the left side.
  7. A loop that will execute a definite number of times is called a ____________________ loop.
  8. Show the output of the program. for k in [ 1, 2, 4 ]: print k, print print "Done!"
  9. The expression range(4) is equivalent to writing ________________________________________.
  10. Statements, such as for, are called control structures. In ONE sentence, explain the concept flow of control.