← Quiz: Strings in C++: all 10 questions
Quiz: Strings in C++ · Question 2 of 10
What does find return when the text is not found?
What does find return when the text is not found?
- A.-1 as an int
- B.0
- C.string::npos
- D.It throws an exception
Answer & explanation
Correct answer: string::npos
npos is the largest size_t value; always compare with it.
Can you get the rest right without peeking?
Take the timed Quiz: Strings in C++ quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →