sample-mid1-ans

sample-mid1-ans - i a[i] b[i] a[i] AND b[i]...

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

View Full Document Right Arrow Icon
CSci 1001 — Spring 2009 Midterm 1 KEY (1) A B (A XOR (NOT B)) (A OR B) F F T T F F F T F F T T T F F T T T T T T F T T (2) (a) True — T AND NOT(F). (b) False — NOT(T AND T AND T) (c) True — F (F OR F) (3) (a) - 115 (by bits: - 128 + 8 + 4 + 1 = - 115) (b) (00, 0A, 8B) (c) 10011101 + 00111101 ---------- 11011010 (4) (a) Kantianism (b) Virtuality fallacy (c) 60 minute music ±le (d) Wikipedia has pages that discuss the accuracy of Wikipedia. (5) The algorithm prints ’does not check’ since at its end sum is 0. Here are the values of a[i] , b[i] , a[i] AND b[i] , and sum after each time through the loop.
Background image of page 1

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

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

Unformatted text preview: i a[i] b[i] a[i] AND b[i] sum--------------------------1 1 1 1 1 2 1 1 1 2 3 1 4 1 5 1-1 6-2 7 1 1 1-1 8 1 1 1 1 (6) Algorithm: 1 Set numBlue <- 0 2 Set numRed <- 0 3 While numBlue < 2 and numRed < 3 4 do release one marble 5 if the marble is blue then 6 numBlue <- numBlue + 1 7 else if the marble is red then 8 numRed <- numRed + 1 9 If numBlue equals 2 then 10 print two blues obtained 11 If numRed equals 3 then 12 print three reds obtained 13 Stop 2...
View Full Document

This note was uploaded on 10/28/2010 for the course CSCI 1001 taught by Professor Staff during the Spring '08 term at Minnesota.

Page1 / 2

sample-mid1-ans - i a[i] b[i] a[i] AND b[i]...

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

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