nerdexam
Oracle

1Z0-804 · Question #42

Give: What is the result?

The correct answer is C. There are 9 sports cars and 5 trucks. Strings are immutable, therefore no change at line: svar.replace(svar,"convertibles"); Format %[argument_index$][flags][width][.precision]conversion The optional argument_index is a decimal integer indicating the position of the argument in the argument list. The first argument…

String Processing

Question

Give:

What is the result?

Exhibit

1Z0-804 question #42 exhibit

Options

  • AThere are 27 sports cars and 5 trucks
  • BThere are 27 convertibles and 5 trucks
  • CThere are 9 sports cars and 5 trucks
  • DThere are 9 convertibles and 5 trucks
  • EIllegalFormatConversionException is thrown at runtime

How the community answered

(56 responses)
  • A
    11% (6)
  • B
    2% (1)
  • C
    82% (46)
  • D
    2% (1)
  • E
    4% (2)

Explanation

Strings are immutable, therefore no change at line: svar.replace(svar,"convertibles"); Format %[argument_index$][flags][width][.precision]conversion The optional argument_index is a decimal integer indicating the position of the argument in the argument list. The first argument is referenced by "1$", the second by "2$", etc. The optional flags is a set of characters that modify the output format. The set of valid flags depends on theconversion. 's', 'S' general 'd' integral The result is formatted as a decimal / integer

Topics

#String.format#format specifiers#printf#integer arithmetic

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice