1606f09final

# 1606f09final - ECOR 1606 Fall 2009 Final Exam Question 1(10...

This preview shows pages 1–3. Sign up to view the full content.

ECOR 1606 Fall 2009 Final Exam Page 2 of 6 Question 1 (10 Marks) What will be output by the following program? int alpha (int x, int &y) { int a = x + y; cout << "CAT " << x * y << endl; x = 4; y = 3; return a % y; } void beta (int x[], int n) { x[0] = x[n]; } int main () { int a = 8, b = 7, c = 10, d = 0, i, j, data[6] = { 5, 4, 3, 2, 1, 8 }, t = 1; bool flag = true; for (i = 1; i < 6; i+= 2) { t *= data[i]; } b = alpha (a, c); cout << "DOG " << a << " " << b << " " << c << " " << t << endl; i = 1; do { d += data[i]; if (d > 15 || i == 3) { flag = false; } i = i + 1; } while (flag); beta(data, 3); // be careful!! cout << "MOUSE " << d << " " << data[5]/3 << " " << data[0] << endl; for (i = 10; i <= 11; i++) { for (j = 0; j <= 2; j++) { cout << i << " " << j << endl; } } system("PAUSE"); return 0; }

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

View Full Document
ECOR 1606 Fall 2009 Final Exam Page 3 of 6 Question 2 (15 Marks) The resistance of “n” resistors connected in parallel is given by the following formula: ) / 1 / 1 / 1 / 1 ( 1 3 2 1 n R R R R R + + + + = K where R i is the resistance of the i th resistor
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

1606f09final - ECOR 1606 Fall 2009 Final Exam Question 1(10...

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

View Full Document
Ask a homework question - tutors are online