Exam1s09part1_w_solutions

Exam1s09part1_w_solutions - EAS 230 Exam 1 PART 1 Problems...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EAS 230 Exam 1 PART 1 Problems 1-10 March 3, 2009 7:00 PM Your Name:___________________________________ Your UBIT Name:_______________________________ Your Section Circle One: (A1, A2, A3, A4, B2, B3, B4) Section 1:Monday 10 am (Section A1) Section 3:Thursday 12:30 pm (Section A3) Section 5:Thursday 11 am (Section B1) Section 7:Friday 11 am (Section B3) Section 2:Thursday 10 am (Section A2) Section 4:Wednesday 6 pm (Section A4) Section 6:Friday 2 pm (Section B2) Section 8:Tuesday 1 pm (Section B4) Circle the correct output of the following program in the box to the right of the program statements using namespace std; #include<iostream> #include<iomanip> #include<cmath> int main() { // //cout<<"Problem 1"<<endl; int i1=17.9, j1=4; cout << i1/j1 << endl; // //cout<<endl<<"Problem 2"<<endl; int j2=‐1; do { j2+=2; cout << "hello" << endl; }while (j2 < 2); cout << j2+1 << endl; // //cout<<endl<<"Problem 3"<<endl; double s3 = 5, u3 = 0.2, d3 = 0.4; s3 *= (1 + u3); s3 ‐= (s3*d3); cout << s3 << endl; a. 5 a. hello hello 4 a. 2.4 b. 4 b. hello 3 b. 5.0 c. 4.475 c. hello hello hello 5 c. 3.6 d. 4.5 d hello 4 d. 0.48 // //cout<<endl<<"Problem 4"<<endl; double r4=2.2; while (r4>=0) { r4‐=2; cout << r4 << endl; } // //cout<<endl<<"Problem 5"<<endl; double e5 = 7.38285; cout<<fixed<<setprecision(4); cout << e5 << endl; // //cout<<endl<<"Problem 6"<<endl; int f6; for (f6=1; f6<3; f6++) cout<<"1.5f6= "<<1.5*f6<<endl; // //cout<<endl<<"Problem 7"<<endl; double r7=100, s7=2, t7=3; int h7; h7=1+r7/(s7*t7); cout<<h7<<endl; // //cout<<endl<<"Problem 8"<<endl; int m8=17, n8=9; cout<<m8%n8<<endl; // //cout<<endl<<"Problem 9"<<endl; int m9=12, n9=17; cout<<setprecision(3)<<m9*2.3/(n9+3.6) cout<<<<endl; // //cout<<endl<<"Problem 10"<<endl; double a10=6.1, b10=2.1, c10=5.1; cout<<setprecision(3)<<a10/b10+c10<<endl; // system("pause"); return 0; } a. 0.2 a. 7.383 a. 1.5f6=1.5f6 a. 17 a. 1.88888 a. 1.000 a. 0.847 b. b. 7.3829 b. 1.5f6=1.50000 1.5f6=3.00000 b. 17.6667 b. 1 b. 1.340 b. 8.005 c. c. 7.3828 c. 1.5f6= 1.50000 c. 16 c. 2 c. 1.339 c. 8.004 d. 0.2 ‐1.8 d. 7.38285 d. 1.50000 d. 16.6667 d. 8 d. 0.000 d. 0.848 ...
View Full Document

This note was uploaded on 09/28/2011 for the course CSE 230 taught by Professor Harvey during the Spring '11 term at SUNY Buffalo.

Ask a homework question - tutors are online