1.

What does function length do in String class?(a) Returns length of string including null character(b) Returns length of string excluding null character(c) Returns length of substring(d) Returns size of string in bytesThis question was addressed to me in an international level competition.My question is based upon String Class in division Inbuilt Classes of Object Oriented Programming

Answer»

The CORRECT ANSWER is (b) Returns length of string excluding null character

Best explanation: The length function returns the length of string. The length is the number of characters in the string but the last null character is not COUNTED. The string length can be USED to loop through each character in the string.



Discussion

No Comment Found

Related InterviewSolutions