Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

GLOBAL IQ COMPUTER EDUCATION CENTRE

P9, A. M. BOSE ROAD, KOLKATA-74 String Output Sheet


Name: Date:

A. Give the output of the following:


1. char ch = ‘a’;
char ch1 =’b’;
String s1= ch + ch1;
String s2 = s1 + “is a concated string”;
System.out.println (s1);
System.out.println (s2);

2. System.out.println (“Computer Science”.length());


System.out.println (“By V.K.Pandey ”.length());
System.out.println (“By D.K.Dey”.length());

3. String str1= “15th August” , str2 = “1947”;


String str = str1 + str2;
System.out.println (str);

4. String x = “Computer” + “Science” + “1” + “0”;


String y = “Arya publishing Company”;
System.out.println (x);
System.out.println (y);

5. char c, d, e;
c = “James Gosling”.charAt(7);
d = “James Gosling”.charAt(0);
e = “James Gosling”.charAt(14);
System.out.println (c + “ “ + d + “ “ + e);

6. boolean x;
x = (“Computer”.length()> “Science”.length())? true : false;

7. char ch = “Computer”.charAt(3);
System.out.println (ch);
String str = “Rajesh” ;
System.out.println (str.replace(‘j’,’k’));

8. Srting x = “Hello”, y = “India”;


System.out.println (x + y);
System.out.println (x.length());
System.out.println (x.charAt(3));
System.out.println (x.equals(y));

Page 1
GLOBAL IQ COMPUTER EDUCATION CENTRE
P9, A. M. BOSE ROAD, KOLKATA-74 String Output Sheet

9. String s = “Super Computer”;


System.out.println (s.toUpperCase());
System.out.println (s.substring(5));
System.out.println (s.substring(5,10));

10. String x = “Computer”, y = “Application”;


System.out.println (x.substring(1,5));
System.out.println (x.indexOf(x.charAt(4)));
System.out.println (y + x.substring(5));
System.out.println (x.equals(y));

11. String s1 = “Vision 2020”, s2 = “vision 2020”, s3 = “India”, s4 = “INDIA”;


System.out.println (s1 + “equals”+ s2 + “” + s1.equals(s2));
System.out.println (s1 + “equals”+ s3 + “” + s1.equals(s3));
System.out.println (s1 + “equals”+ s4 + “” + s1.equals(s4);
System.out.println (s1 + “equalsignoreCase”+ s4 + “” + s1.equalsIgnoreCase(s4);

Page 2

You might also like