{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# EXAM - EAS230 Fall 2011 Exam 1 50 minutes Name Each...

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

EAS230 Fall 2011 Exam 1 50 minutes Each question is worth 3 points Name : _________________________________ Person Number : ________________ Answer Sheet: Place all of your answers here. Please return the entire exam. If you use pencil, you forfeit your right for any re-grades. 1. ______________________________ 2. ______________________________ 3. ______________________________ 4. ______________________________ 5. ______________________________ 6. ______________________________ 7. ______________________________ 8. ______________________________ 9. ______________________________ 10. ______________________________ 11. ______________________________ 12. ______________________________ 13. ______________________________ 14. ______________________________ 15. ______________________________ 16. ______________________________ 17. ______________________________ 18. ______________________________ 19. ______________________________ 20. ______________________________ 21. ______________________________ 22. ______________________________ 23. ______________________________ 24. ______________________________ 25. ______________________________ 26. ______________________________ 27. ______________________________ 28. ______________________________ 29. ______________________________ 30. ______________________________ 31. 32. 33.

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

View Full Document
This is a closed book, closed notes exam. There are no trick questions. The obvious answer is usually correct. Answer questions (1) to (10) based on the C++ program given below. Note that the lines have been numbered for easy reference so the numbers are not part of the code. 1 #include <iostream> 2 #include <cstdlib> 3 #include <ctime> 4 #include <cmath> 5 using namespace std; 6 int main() { 7 int coinFlips = 0; //no. of coin flips; 8 int randomNumber = 0; // result of rand num generator 9 int numberOfHeads = 0, numberOfTails = 0; 10 int signOfTrouble = 0; 11 double percentage = 0.0; 12 13 srand( (int)time(0) ); 14 15 // flip 10000 coins 16 for (coinFlips = 1; coinFlips <= 10000; coinFlips++) 17 { 18 // generate a random number 0-9 19 randomNumber = rand()%10; 20 // if it's 5 or greater, count as a head 21 if (randomNumber >= 5) 22 { 23 numberOfHeads++; 24 } 25 // 4 or less, count as a tail 26 else 27 { 28 numberOfTails++; 29 } 30 cout<<randomNumber<<" "<<numberOfHeads<<" "<<numberOfTails<<endl; 31 } // end for 32 33 // this refelcts the number of coin tosses that stray from 50/50 34
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