midtermA_spr10_answers

midtermA_spr10_answers - EXAM A ANSWERS 1(20 points int num...

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

View Full Document Right Arrow Icon
AAAAA 1 ***** EXAM A ANSWERS ***** 1. (20 points) int num, previous = -1; cout << "Enter a series of positive integers, negative to stop: "; cin >> num; while(num >= 0) { if(num != previous) cout << num << " "; previous = num; cin >> num; } cout << endl; 2. (15 points) a) Explain the difference between a function declaration and a function definition . The declaration tells the compiler the name, return type, and number and data types of the parameters. It is essentially the function header followed by a semi- colon placed before int main(). The definition consists of the header (similar to the declaration) and the body which contains the statements to be executed b) Floating point numbers are represented by an exponent and a mantissa. If we reduce the number of bits that are a part of the exponent, and increase the size of the mantissa, what is the effect on the precision and range? The range will become smaller and the precision will become larger. c) True or False (circle one) Using = instead of == in an expression to check whether two variables are equal is an error that will be caught by the compiler.
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern