Which of the following are legal definitions with initializations? (Consider each line to be in a different scope so there is no multiple definition of identifiers.)

a. int count = 0, limit = 19;
b. int count(0), limit(19);
c. int count = 0, limit(19);
d. int limit = 19;
e. int namespace(0);


All are legal except part e) int namespace(0); because namespace is a keyword. Keywords are reserved so may not be used as an identifier.
Explanation: Note parts a), b), and c). Some authors advocate declaring each identifier in separate definitions on separate lines, though this takes up more lines. Advocates justify this by asserting increased readability. The instructor must decide this issue.

Computer Science & Information Technology

You might also like to view...

A contigous segment of an array is given by specifying two subscripts, lower and upper. Which of the following expressions gives the subscript of the array element that is three quarters of the way from lower to upper?

A) lower + 3 * upper /4 B) lower /3 + upper C) (upper — lower) * 3 /4 D) lower + (upper — lower) * 3 / 4

Computer Science & Information Technology

What command would you use if you wanted a list of files in the current directory displayed on the screen that you could page through if the list was too long to fit on one screen?

A. dir -page B. get-childitem > more C. get-childitem | more D. dir \more

Computer Science & Information Technology

The ________ options, in the Arrange group, under the FORMAT tab, enable you to place an object in a preset location within a document with Square text wrapping

A) Format B) Sizing C) Paste D) Position

Computer Science & Information Technology

A hyperlink in a worksheet may take you to which of the following locations ________

A) links dialog box B) a page break C) another location in the worksheet or the company intranet D) home

Computer Science & Information Technology