CSE MCQs :: JAVA MCQs
- Which of these data type value is returned by equals() method of String class?
- Which of these method of class String is used to extract a substring from a String object?
-
What will s2 contain after following lines of code?
String s1 = "one;
String s2 = s1.concat("two)
- Which of these method of class String is used to remove leading and trailing whitespaces?
- What is the value returned by function compareTo() if the invoking string is less than the string compared?
- Which of the following statement is correct?
- Which of these class is used to create an object whose character sequence is mutable?
- Which of these method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
- Which of these method of class StringBuffer is used to find the length of current character sequence?
-
What is the string contained in s after following lines of code?
StringBuffer s new StringBuffer("Hello);
s.deleteCharAt(0);
A.
replace() method replaces all occurrences of one character in invoking string with another character.
|
B.
replace() method replaces only first occurances of a character in invoking string with another character.
|
C.
replace() method replaces all the characters in invoking string with another character.
|
D.
replace() replace() method replaces last occurrence of a character in invoking string with another character.
|