Q.1
What will be output?
String S1 = "S1 ="+ "123"+"456";
String S2 = "S2 ="+(123+456);
Q.2
What will be the output of the following program code?
public class Test{
      public static void main(String args[]){
            String s = "what";
            StringBuffer sb = new StringBuffer("what");
            System.out.print(sb.equals(s)+","+s.equals(sb));
      }
}
Q.3
What will be the output?
1. public class Test{
2.      public static void main(String args[]){
3.            Object myObj = new String[]{"one", "two", "three"};
4.            {
5.	          for(String s : (String[])myObj) 
6.		        System.out.print(s + ".");
7.	    }
8.      }
9. }
Q.4
Determine output:
public class Test{
      public static void main(String args[]){
            String str = null;
            if(str.length() == 0){
                  System.out.print("1");
            }
            else if(str == null){
                  System.out.print("2");
            }
            else{
                  System.out.print("3");
            }
      }
}
Q.5
String str1 = "Kolkata".replace('k', 'a');
In the above statement, the effect on string Kolkata is
Q.6
The class string belongs to ................. package.
Q.7
What will be the output?
public class Test{ 
        public static void main (String[] args){ 
		String test = "a1b2c3"; 
                String[] tokens = test.split("\\d"); 
                for(String s: tokens) 
                        System.out.print(s); 
	} 
}
Q.8
How many objects will be created?
String a = new String("Examveda");
String b = new String("Examveda");
String c = "Examveda";
String d = "Examveda";
Q.9
How many Constructor String class have?
Q.10
toString() method is defined in
Q.11
The String method compareTo() returns
Q.12
What will be the output?
String str1 = "abcde";
System.out.println(str1.substring(1, 3)); 
Q.13
What is the output of the following println statement?
String str1 = "Hellow";
System.out.println(str1.indexOf('t'));
Q.14
What will be the output of the following program?
public class Test{
        public static void main(String args[]){
		String str1 = "one";
		String str2 = "two";
		System.out.println(str1.concat(str2));
        }
}
0 h : 0 m : 1 s