Q Which of the following is the correct way to get the length of string variable in C++?

  • A Name.length()
  • B Length(name)
  • C Name.size()
  • D Size(name)

MCQs Details

The string length in C++ can be found using the length() and size() methods. The size() is consistently used with STL containers (Standard library templates) like map, vector, etc., and length is consistently used with character strings, words, se