English

If a string contains 12 characters, what will be the index of the last character? - Computer Applications

Advertisements
Advertisements

Question

If a string contains 12 characters, what will be the index of the last character?

Options

  • 12

  • 11

  • 10

  • 0

MCQ

Solution

11

Explanation:

Most computer languages (Java, Python, and C++) use zero-indexed strings, meaning character indexing begins at 0. So, if a string has 12 characters, the index of the last character is 11 (since the first character is at index 0). 

shaalaa.com
  Is there an error in this question or solution?
Chapter 4: String Handling - EXERCISES [Page 286]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 4 String Handling
EXERCISES | Q I. 3. | Page 286
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×