C++ Final Review Solutions 1. Give a short definition of each of the following words. (all are on the final!) a. return value-the number (or other data) returned by a method. b. declaration--telling C++ to make a "mailbox". e.g. int nNum; c. intialization--putting a number or value in a "mailbox" for the first time. d. garbage--an unintialized value. What's "left over" in the mailbox if you don't initialize it. e. enum--a shortcut to making more than one integer constant. f. Cast-temporarily treating data like another data type. (e.g. int(dDouble)). g. break-"jumps" to end of block of code. h. Syntax error-a spelling error or typo in code. i. out-of-bounds index-an integer in square brackets that is too large or too small. j. case-part of a switch statement. k. Argument-data that is passed to a method. l. Parameter-same as an argument. m. actual argument--argument in function call. n. formal argument--argument in function header or prototype. o. #include--includes other programmers code in your program. p. void-"nothing" q. keyword-a word that has special meaning and cannot be used as the name of a variable or method. r. Hungarian notation-a system for naming variables and methods. s. long-a bigger mailbox than int for holding integers. t. Literal-NOT a variable (e.g. 3, 'c' or "Hello" NOT nNum, cChar or sString) u. Relational operator- > < >= <= == != v. Logical operator- && || ! w. Assignment operator--the single equals = 2. Complete the following code fragment so that it displays the sum of all the multiples of 3 from 1 to nNum. (Assume that nNum has already been declared and initialized) int nInt, nSum; _ nSum = 0 _; for (_ nInt = 1; nInt <= nNum; nInt++_) { if (_ nInt % 3 == 0 __) nSum = nSum + nInt; } cout< 50) { nX = nX + (nI * nJ); nJ -= 10; System.out.prinln("hello"); } nI = nI + 5; } hello will be displayed 25 times, the outer loop will run 5 times (nI = 1, 6, 11, 16, 21) and the inner loop will run 5 times (nJ = 100, 90 , 80, 70, 60)