{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ENGE_2314_old_test_2_for_study

ENGE_2314_old_test_2_for_study - ENGE 2314 OLD TEST 2 For...

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

ENGE 2314 OLD TEST 2 For study Form A Page 1 of 9 1. Examine the following prototype and choose the most true answer: ostream& operator<< (ostream&, const Box&); 1. The prototype refers to an overloaded definition of the << operator that is defined in the class named “const”. 2. The corresponding function definition of the above prototype returns nothing. 3. If the corresponding function definition attempts to alter the values of the private data members of the Box object, the code will not compile. 4. The prototype has a syntax error. 5. The keyword const is the name of a built-in data type 6. The parameters are being passed to the function by value. 7. Statements (1) and (2) are correct 8. Statements (2) and (3) are correct 9. Statements (3) and (5) are correct 10. Statements (1) and (3) are correct 2. Which two-statement sequence is equivalent to this three-statement sequence? x = y * 10; y = y + 1; z = z * (y + 5); (1) x = y + 1 * 10; z *= y * 5; (2) x = y + 1 * 10; z = ++y + 5 * z; (3) x = ++y * 10; z *= y + 5; (4) x = ++y * 10; z = ++x - 1; (5) x = y++ * 10; z *= y + 5; (6) x = y++ * 10; z = ++y + 5; (7) y = z + 1 * 10; x = z-- * y + 5; (8) y = z + 1 * 10; x = ++y + 5 * --z; (9) y *= 10 + x ++ 10; z *= y + 5; (10) y *= 10 + x ++ 10; z = y++ + 5 * z; 3. What output is displayed by this statement if the value of x is -33.963? (# designates a space, . designates a period) cout << setiosflags(ios::fixed|ios::showpoint) << setprecision(2) << setw(10) << x << endl; (1) ###-33.963 (2) -33.963### (3) ##-33.96## (4) -...33.963 (5) - .... 33.96 (6) -33.96#### (7) -33.###### (8) ######-33. (9) ####-33.96 (10) ...-33.96

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

View Full Document
ENGE 2314 OLD TEST 2 For study Form A Page 2 of 9 4. How many lines of output will be displayed by the following program fragment? for (int i=0; i<5; i++) for (int j=0; j<i; ++j) cout << i << j << endl; (1) 4 (2) 5 (3) 6 (4) 9 (5) 10 (6) 11 (7) 12 (8) 15 (9) 17 (10) 20 5. Which statement is most true? (1) The local variable of a function is not visible in a separate function existing outside the definition of the function declaring the local variable. (2) The statement double sum (double x, y); is a valid prototype. (3) Function prototypes are always required for all functions that are defined. (4) Statements (1) and (2) are true. (5) Statements (2) and (3) are true. (6) Statements (1) and (3) are true. (7) Statements (1), (2), and (3) are true. (8) All the above statements are false. 6. A function that does not return a value to the calling statement, is commonly referred to as a(n) function. (1) dummy (2) empty (3) holding (4) null (5) placebo (6) pointless (7) prototype (8) returnless (9) valueless (10) void 7. The method of passing the storage location of a variable as an argument to a function, is called pass-by- .
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}