Home / Questions / Give the output of the following string functions: "MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I') "CABLE".compareTo("CADET")
Explanatory Question

Give the output of the following string functions:

  1. "MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I')
  2. "CABLE".compareTo("CADET")

👁 78 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  1. 2 + 10 = 12
  2. ASCII Code of B - ASCII Code of D
    ⇒ 66 - 68
    ⇒ -2