Test 1 study guide.doc

Test 1 study guide.doc - b. W = ++X / y++ * ++a ; (Break...

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

View Full Document Right Arrow Icon
Test 1 study guide: This is just a guide referring to major topics covered so far. 1) cin and cout use. Questions will be on finding errors and showing how the statement works: a. Cout << Num Errors: Cpital C, and missing ; b. cin << num ; Error : Wrong operator >> not << c. What is printed: float num = 3.435654; cout << “Result = $“<< num; prints: Result = $3.435654 cout <<”Result = $” << setprecision(2) << setw(7) << num ; Result = $ 3.44 d. Sample program using formats is posted on BB review it. (formats.cpp, setw.cpp) 2) Declaring variables: a. What is an identifier? b. From the list : 1_jack, Jack_1, R2d3, K#1, which are valid identifiers ? 3) Evaluate arithmetic expression: for the following values int X =3, y =4; float a = 2.5; Use initial values for each statement. Break down a. W = X++ /y++ * a++ ; (Break down the problem based on operator precedence) W = X / y * a ¾ * 2.5 0 * 2.5 = 0 X++ 4 Y++ 5 A++ 3.5 W = 0.0, y = 5, a = 3.5 , X = 4
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b. W = ++X / y++ * ++a ; (Break down the problem) ++X 4 ++a 3.5 W = X / y * a W = 4/4 * 3.5 W = 1 * 3.5 W = 3.5 y++ 5 W = 3.5, y = 5, a = 3.5, X = 4 ; c. a += ++X * y --; X = 4, a = 18.5, y = 3 d. X /= y++ % ++X ; X++ 4 X = X / y % X X = X / (4 % 4 ) X = X / 0 Error division by 0 4) Write an algorithm and a C++ program. Including functions and classes. (Similar to the ones done at home or in the lab) (Sample program posted on BB) 5) Write a function. (Sample program posted on BB) 6) Know the following definitions: o Algorithm o Software Engineering o Software Life cycle (Development cycle) (Analysis, Design, Implementation,) o Purpose of Comments in a program o Identifiers (variables,. .) o Pass by value (in functions) o Prototypes (what are they, and why use them) o Classes (what are they, why use them) o Objects (what are they, difference with simple variables)...
View Full Document

Ask a homework question - tutors are online