Tuesday, December 8, 2009

Review of first of two sample midterm 2s

watch here for more.

http://venus.cs.qc.edu/~jlevy/cs80/docs/sample-Test.pdf

multiple choice answers -- for clarification, email me.
1) D
2) A
3) C, because we negate the condition
4) C
5) C
6) C
7) C
8) D
9) here, num(k) is exactly the same as k.
therefore, it is 10^1 + 10^2 + 10^3 + 10^4
which is 11110
therefore, B
10) This is just asking for phrase(1), not for the
entirety of phrase. Each time, we search for the
next space, and take the substring from the *beginning*
up to that space. So, it should be the first two words,
every path.
Therefore, B

Programming:
1)
' We need to make an array to store those:
Dim a(999) as Integer
' then read those numbers in
for each x in a
x = InputBox("gimme the next number")
next
' and then start from the *end* of the array to print
for i = 999 To 0
Debug.Print(a(i))
next

2) ' in the last for loop, replace with
for i = 999 To 0
   if a(i) mod 2 = 0 then
Debug.Print(a(i))
   end if
next

No comments:

Post a Comment