Difference between revisions of "CSC111 Midterm Exam Preparation 2015"

From dftwiki3
Jump to: navigation, search
Line 33: Line 33:
 
=Question 4=
 
=Question 4=
 
<br />
 
<br />
 
+
What is this?
 
+
<center>[[File:CSC103 SIMM Memory.jpg|250px]]</center>
 
+
<br />
 +
How does it relate to programming and to Python?
 +
<br />
 +
=Question 5=
 +
<br />
 +
What is printed by this program?
 +
<br />
 +
::<source lang="python">
 +
a = "Hello"
 +
b = "There"
 +
c = 123
 +
d = a, b, c
 +
c, a, b = d
 +
print( a, b, c, d )
 +
</source>
 +
<br />
 +
=Question 6=
 +
<br />
 +
Write a loop that prints all the numbers between -100 and 100, included, that are multiples of 5.  The numbers should be output one per line.  The first line will contain -100, the next line, -95, then -90, and at the end, 95, and 100, on the last line.
 +
<br />
 +
=Question 7=
 +
<br />
 +
Study this piece of code:
 +
<br />
 +
<source lang="python">
 +
a = 3
 +
b = 11
 +
c = 21
 +
d = (b+c) / a
 +
</source>
 +
<br />
 +
When the last assignment is done, will '''d''' be a float or an integer?
  
  

Revision as of 19:59, 28 February 2015

--D. Thiebaut (talk) 18:08, 28 February 2015 (EST)


Midterm Exam Prep

The midterm is an in-class exam given under the rules of the honor code. It lasts 70 minutes. It will be closed books, closed notes, closed computers.



...