🎙 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 10 of 10

Which is the simplest way to check whether two words are anagrams?

Which is the simplest way to check whether two words are anagrams?

  1. A.Compare their lengths only
  2. B.Compare the first and last letters
  3. C.Sort both strings and compare them
  4. D.Reverse one and compare
Answer & explanation

Correct answer: Sort both strings and compare them

Anagrams have the same letters with the same counts, so their sorted forms are equal.

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 →