{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

FinalExam

# FinalExam - UNIVERSITY AT BUFFALO EAS 230 Final Examination...

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

UNIVERSITY AT BUFFALO EAS 230 Final Examination Part I December 8, 2008 Each of the 20 questions on Part I is worth 5 points. NAME ____________________________ SECTION#_______ UBIT ID (email):__________ Select the correct output from the given code fragment, or provide answer in the box, where appropriate. Assume the rest of the code is error free and does not cause either compilation or run-time errors. Question 3 double x=2.0, y=3.0; cout << pow(x,y) – pow(y,x) << endl; a. -1 b. 0 c. 1 d. 8 Question 1 int i=7, j=6; cout << (i--)%(--j) << endl; a. 0 b. 1 c. 2 d. 5 Question 2 int i=2, j=3; double x=0.5; cout << setprecision(4)<< (j/i)*sin(x) << endl; Question 4 double x=4.4, j=2.0; cout << pow(sin(x),j)+pow(cos(x),j) << endl; a. -1.2589 b. 1 c. 1.0738 d. 0.8111 Question 5 int i, j=3; for (i=2; i<10; i+=j){ if (i>6) { j++; } } cout << i << endl;

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

View Full Document