Important MCQ

string s = "Hello"; s.length() is

Q.string s = "Hello"; s.length() is

A) 5
B) 0
C) 6
D) 4
Correct Answer:
Option A
Detailed Explanation:
A) 5 is correct. The string class is provided by . String indexes start at 0; length() and size() report character count, substr extracts part of a string, and getline reads spaces.