11.  Which of these method of class String is used to obtain length of String object ?


get()
Sizeof()
lengthof()
length()


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

12.  What is the output of this program ?
class output {
public static void main(String args[])
{
String s1 = ‘‘Hello World’‘;
String s2 = s1.substring(0 , 4);
System.out.println(s2);
}
}


Hell
Hello
Worl
World


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

13.  What is the output of this program ?
class output {
public static void main(String args[])
{
String s1 = ‘‘Hello’‘;
String s2 = s1.replace('l','w');
System.out.println(s2);
}
}


hello
helwo
hewlo
hewwo


Answer

 Option

replace() method replaces all occurrences of one character in invoking string with another character. s1.replace(‘l’,’w’) replaces every occurrence of ‘l’ in hello by ‘w’, giving hewwo.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

14.  Which of these class is superclass of String and StringBuffer class ?


java.util
java.lang
ArrayList
None of the mentioned


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

15.  What will s2 contain after following lines of code ?
String s1 = ‘‘one’‘;
String s2 = s1.concat(‘‘two’‘)


one
two
onetwo
twoone


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report