# Provided by the Open.Michigan initiative at the University of Michigan # Licensed under a Creative Commons Attribution 3.0 License: # http://creativecommons.org/licenses/by/3.0/. # Copyright 2009, Chuck Severance. SI502 - Assigment - Zelle Chapter 1 Due Date: Friday January 16 at 6PM Monday Discussion Due Date: Tuesday January 20 11PM Answer the following questions and turn your edited document document into CTools under Assignments. If a question is confusing - feel free to comment on what confuses you w.r.t. the question. Keep the file a Text file with a .txt extension - Use your programmer editor (i.e. JEdit to edit the file). Bring this to Discussion in paper or laptop form - you can talk about the questions in Discussion and improve your answers - and then turn the assignment in after Discussion. 1) What is the function of the secondary memory in a computer a) Execute all of the computation and logic of the program b) Retrieve web pages over the Internet c) Store information for the long term - even beyond a power cycle d)Take input from the user Answer: --- Put answer here ---- 2) What is a program? 3) What is is the difference between a compiler and an interpreter? 4) Which of the following is in "machine language"? a) The Python interpreter b) The keyboard c) Python source code d) The secondary memory Looking at the following Python code for i in range(10): print "Howdy" print "Bob" if i < 10 : print "Zap" 5) Which of the following types of program steps is *not* in the above code sequence? a) Sequential b) Conditional c) Repetitive d) Store and reuse 6) Which of the above lines will be conditionally executed? a) Howdy b) Bob c) Zap d) for 7) What is the purpose of the "def" keyword in Python? a) It is slang that means "the following code is really cool" b) It indicates the start of a function c) It indicates that the following indented section of code is to be stored for later d) b and c are both true e) None of the above 8) What numbers will the following Python code print out? for i in range(5): print i a) 0 1 2 3 4 5 b) 1 2 3 4 5 c) 1 5 d) 0 1 2 3 4 e) 0 0 0 0 0 9) What will the following Python program print out? def fred(): print "Zap" def jane(): print "ABC" jane() fred() jane() a) Zap ABC jane fred jane b) Zap ABC Zap c) ABC Zap jane d) ABC Zap ABC e) Zap Zap Zap 10) Where in the computer is a variable such as "X" stored? x = 123 a) Central processing unit b) Main Memory c) Secondary Memory d) Input Devices e) Output Devices 11) What will the following program print out: x = 43 x = x + 1 print x a) 43 b) 44 c) x + 1 d) Error because x = x + 1 is not possible mathematically