1.

Pick the correct statement about string objects in C++.(a) String objects must be terminated by a null character(‘\0’)(b) String objects have a static size(c) String objects have a dynamic size(d) String objects use extra memory than required.I got this question in an interview for job.I'd like to ask this question from String in chapter Source Files, Classes and Operator Overloading in C++ of C++

Answer»

Correct answer is (C) STRING objects have a dynamic size

To explain: String objects are dynamic in nature i.e. their size varies as their VALUE changes so they don’t use any EXTRA memory and it is not NECESSARY to terminate a string object by ‘\0’.



Discussion

No Comment Found

Related InterviewSolutions