🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.-1 as an int
  2. B.0
  3. C.string::npos
  4. 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 →