mockfinalexam6april2010

# mockfinalexam6april2010 - PEER ASSISTED STUDY SESSIONS MOCK...

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

PEER ASSISTED STUDY SESSIONS – MOCK FINAL EXAM Facil: Idris Aleem Course: ECOR 1606 Date: April 6, 2010 Office Hour: Thursdays 2:00 – 3:00 PM, TB 302 Email Address: [email protected] DISCLAIMER: PASS handouts are designed as a study aid only for use in PASS workshops. Handouts may contain errors, intentional or otherwise. It is up to the student to verify the information contained within. DURATION: 3 HOURS Question 1 (20 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
PEER ASSISTED STUDY SESSIONS – MOCK FINAL EXAM Facil: Idris Aleem Course: ECOR 1606 Date: April 6, 2010 Office Hour: Thursdays 2:00 – 3:00 PM, TB 302 Email Address: [email protected] DISCLAIMER: PASS handouts are designed as a study aid only for use in PASS workshops. Handouts may contain errors, intentional or otherwise. It is up to the student to verify the information contained within. Question 2 (20 marks) Write a function called outputOddArray, which, given a double array and the number of values in the array, outputs the odd values of the array as a table to an output file. The values should be output with 3 decimal places.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/28/2011 for the course MATH 101 taught by Professor Duke during the Spring '11 term at University of Ottawa.

### Page1 / 6

mockfinalexam6april2010 - PEER ASSISTED STUDY SESSIONS MOCK...

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

View Full Document
Ask a homework question - tutors are online