Important MCQ

string s = "Hello"; s.substr(1, 3) gives

Q.string s = "Hello"; s.substr(1, 3) gives

A) ell
B) ello
C) He
D) Hel
Correct Answer:
Option A
Detailed Explanation:
A) ell 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.