1.  Which of these operators can be used to concatenate two or more String objects ?


+
+=
&
||


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  What is the output of this program ?
class String_demo {
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
String s1 = ‘‘abcd’‘;
int len1 = s1.length();
int len2 = s.length();
System.out.println(len1 + ‘‘ ‘‘ + len2);
}
}


3 0
0 3
3 4
4 3


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

3.  What is the output of this program ?
class output {
public static void main(String args[])
{String s = ‘‘Hello World’‘;
int i = s.indexOf('o');
int j = s.lastIndexOf('l');
System.out.print(i + ‘‘ ‘‘ + j);
}
}


4 8
5 9
4 9
5 8


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

4.  What is the output of this program ?
class String_demo {
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}


a
b
c
abc


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  What is the output of this program ?
class output {
public static void main(String args[])
{
String chars[] = {‘‘a’‘, ‘‘b’‘, ‘‘c’‘, ‘‘a’‘, ‘‘c’‘};
for (int i = 0; i < chars.length; ++i)
for (int j = i + 1; j < chars.length; ++j)
if(chars[i].compareTo(chars[j]) == 0)
System.out.print(chars[j]);
}
}


ab
bc
ca
ac


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report