Which of the following is(are) invalid string constant(s)? A. “7.15 pm” B. “i like e” C. “7.3el2” D. “1234el2” E. None of the above

[amp_mcq option1=””7.15 pm”” option2=””i like e”” option3=””7.3el2″” option4=””1234el2″ E. None of the above” correct=”option3″]

The correct answer is: C. “7.3el2”

A string constant is a sequence of characters enclosed in double quotes. The following are valid string constants:

  • “7.15 pm”
  • “i like e”
  • “1234el2”

However, the string constant “7.3el2” is invalid because it contains the character “l” which is not a valid character in a string constant.

The following are the valid characters in a string constant:

  • Letters (a-z, A-Z)
  • Numbers (0-9)
  • The underscore (_)
  • The dollar sign ($)
  • The at sign (@)
  • The percent sign (%)
  • The ampersand (&)
  • The apostrophe (‘)
  • The quotation mark (“)
  • The less-than sign (<)
  • The greater-than sign (>)
  • The question mark (?)
  • The colon (:)
  • The semicolon (;)
  • The comma (,)
  • The period (.)
  • The forward slash (/)
  • The vertical bar (|)
  • The spacebar
  • The tab character
  • The newline character
Exit mobile version