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. The columns of the table should be 20 units.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern