{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exams0809

# Exams0809 - hello 2 Problem 3 a 6 b 2 c 3 d 5 Problem 4 a 2...

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

1 EAS 230 Exam 1 PART 1 Problems 1-10 October 15, 2008 7:00 PM 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() { int i; cout<<"Problem 1"<<endl; i = 7.231592; cout << i << endl; cout<<endl<<endl;cout<<"Problem 2"<<endl; int j=2; do { j++; cout << "hello" << endl; }while (j <= 2); cout << j << endl; cout<<endl<<endl;cout<<"Problem 3"<<endl; double shareprice = 5; double up = 0.2; double down = 0.5; shareprice *= (1 + up); shareprice -= (shareprice*down); cout << shareprice << endl; cout<<endl<<endl;cout<<"Problem 4"<<endl; int k=2; while (k>0) { k--; cout << k << endl; } cout << k << endl; Your Name:___________________________________ Your UBIT Name:_______________________________ Your Section Circle One: (A1, A2, A3, A4, B2, B3, B4) Problem 1 a. 14 b. 7 c. 7.232 d. 8 Problem 2 a. hello hello 3 b. hello

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

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

Unformatted text preview: hello 2 Problem 3 a. 6 b. 2 c. 3 d. 5 Problem 4 a. 2 c. 1 1 0 0 b. 2 d. 1 1 0 c. hello hello 4 d. hello 3 2 cout<<endl<<endl<<"Problem 5"<<endl; double e = 27.382818; cout<<fixed; cout<<setprecision(3); cout << e << endl; cout<<endl<<endl;cout<<"Problem 6"<<endl; int f; for (f=1;f<3;f++) cout<<"2f= "<<2*f<<endl; cout<<endl<<endl;cout<<"Problem 7"<<endl; double r=1, s=2, t=3; int h; h=r/s*t; cout<<h<<endl; cout<<endl<<endl;cout<<"Problem 8"<<endl; int m=7, n=9; cout<<m%n<<endl; cout<<endl<<endl; cout<<"Problem 9"<<endl; cout<<n%m<<endl; cout<<endl<<endl;cout<<"Problem 10"<<endl; double a10=6, b10=2, c10=5; cout<<a10/b10+c10<<endl; system("pause"); return 0; } Problem 5 a. 27 b. 27.4 c. 27.382 d. 27.383 Problem 6 a. 2f= 2 2f= 2 b. 2f = 4 2f= 2 Problem 7 a. 7 b. 1 c. 1.5 d. 0.667 Problem 8 a. 7 b. 1 c. 1.286 d. 0.778 Problem 9 a. 7 b. 2 c. 1.286 d. 0.778 Problem 10 a. 7.000 b. 5.333 c. 8.000 d. 0.857 c. 2f= 3 2f= 6 d. 2f= 2 2f= 4...
View Full Document

{[ snackBarMessage ]}