midtermA_spr10_answers

midtermA_spr10_answers - * EXAM A ANSWERS * 1. (20 points)...

Info iconThis 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)
Background image of page 1

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

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

This note was uploaded on 10/28/2010 for the course CSCI 1113 taught by Professor Staff during the Spring '08 term at Minnesota.

Page1 / 4

midtermA_spr10_answers - * EXAM A ANSWERS * 1. (20 points)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online