Midterm05Solved - Solution to Midterm 2005 Question 1a) The...

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

View Full Document Right Arrow Icon
Solution to Midterm 2005 Question 1a) The integer X has the value 5, and the array Y initially contains the following values: {2, 4, 6, 8, 10}. Only one of the following Boolean expressions evaluates to true. Circle the letter corresponding to the expression that evaluates to true. a) (X < 5) OR (Y[Y[1]] = 8) b) (Y[4] ÷ 2 = X) AND (X MOD 2 = Y[1] MOD 2) c) (X > Y[2]) AND (X Y[3]) d) Y[Y[0]] × 2 = (2 × X + X MOD 3) e) X × X Y[1] × Y[2]
Background image of page 1

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

View Full DocumentRight Arrow Icon
Question 1a) The integer X has the value 5, and the array Y initially contains the following values: {2, 4, 6, 8, 10}. Only one of the following Boolean expressions evaluates to true. Circle the letter corresponding to the expression that evaluates to true. a) (X < 5) OR (Y[Y[1]] = 8) F OR Y[4] = 8 F OR 10 = 8 F OR F F Question 1a) The integer X has the value 5, and the array Y initially contains the following values: {2, 4, 6, 8, 10}. Only one of the following Boolean expressions evaluates to true. Circle the letter corresponding to the expression that evaluates to true. b) (Y[4] ÷ 2 = X) AND (X MOD 2 = Y[1] MOD 2) 10 ÷ 2 = 5 AND ( 5 MOD 2 = 4 MOD 2 ) 5 = 5 AND ( 1 = 0 ) T AND F F
Background image of page 2
Question 1a) The integer X has the value 5, and the array Y initially contains the following values: {2, 4, 6, 8, 10}. Only one of the following Boolean expressions evaluates to true. Circle the letter corresponding to the expression that evaluates to true. c) (X > Y[2]) AND (X Y[3]) 5 > 6 AND 5 8 F AND T F Question 1a) The integer X has the value 5, and the array Y initially contains the following values: {2, 4, 6, 8, 10}. Only one of the following Boolean expressions evaluates to true. Circle the letter corresponding to the expression that evaluates to true. d) Y[Y[0]] × 2 = (2 × X + X MOD 3) Y[2] × 2 = (2 × 5 + 5 MOD 3) 6 × 2 = (10 + 2) 12 = 12 T
Background image of page 3

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

View Full DocumentRight Arrow Icon
Question 1a) The integer X has the value 5, and the array Y initially contains the following values: {2, 4, 6, 8, 10}. Only one of the following Boolean expressions evaluates to true. Circle the letter corresponding to the expression that evaluates to true.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/06/2011 for the course ITI 1120 taught by Professor Inkpen during the Fall '07 term at University of Ottawa.

Page1 / 13

Midterm05Solved - Solution to Midterm 2005 Question 1a) The...

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

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