0% found this document useful (0 votes)
22 views2 pages

String Bits

Uploaded by

gyankeshnss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

String Bits

Uploaded by

gyankeshnss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Student Name : RollNo : Class : Sec :

Please take Print and write the answers for the following Bits , Submit on Monday 14/04/2025

What will he the output of the following program segments ?


1) String s = "application";
int p = [Link](‘a');
System .out. println(p) ;
System .out . prinln(p+s );

2) String st = "PROGRAM”;
System .out .primln([Link]([Link](4)));

3) while (true)
{
If ([Link] (“.”))
break;
[Link] ([Link]().charAt(0)); }
Where st =”Delhi Public School” . Give the output.

4. String s1 = “MINORITY”; String s2 = “REPORT”;


[Link]([Link]([Link](‘R’) + [Link](‘R’)));
[Link]((“Hello”.indexOf(‘l’) + “Computer Application”.indexOf(‘p’, 6)));

5. What do the following functions return for:


String x =” Computer” ; String y = “Applications”;
a) [Link](x+y);
b) [Link]([Link]() + [Link]());
c) [Link]([Link](3));
d) [Link]([Link](y));
e) [Link]([Link](‘i’));

6. Write output for the following.


a) “PRIME NUMBER”.indexof(‘M’,6)
b) “UNDERSTANDING”.compareTo(“UNION”)
c) “Today Is Working Day”.substring(4,9)

7. String s1 = “MINORITY”; String s2 = “REPORT”;


[Link]([Link]([Link](‘R’) + [Link](‘R’)));

8. Write output for the following.


a) “COMPUTER”.length()
b) “PRIME NUMBER”.indexof(‘M’,6)
c) “uniom”..compareTo(“UNION”)
d) “A P S SCHOOL”.substring( 4, 9)
e) “FRIENDS”.reverse();
f) “ BEAUTIFUL DAY “. trim().length()
g) “School Day”.endsWith(“DAY”)

9. Give the output of the following


char ch=’A’;
int x = 32, y = 2;
[Link](ch+y);
[Link](ch+x);
[Link](++ch);
[Link]((char)(ch+x+y));
10. Give the output of the following statements
a) (int)(“scholar”.charAt(4))
b) “TuTOrIAl”.indexOf(‘l’)
c) “kumarvivek”.substring( 3, 4)
d) “MISSISSIPPI”.lastindexOf(‘S’)
e) “COMPUTE”.compareTo(“CALCULATE”)

11. The return type of the function [Link]() is ______________.


12. The output of the java statement “Ranchi”.indexOf(‘a’) is ____________ .
13. The return type of the function startsWith( ) is ______________.
14. The output of “MaHAtMA”.toLowerCase( ) is
15. Difference between toUpperCase() , [Link]() and [Link]() .
16. a) The return type of the function [Link]() is ______________
b) The return type of the function indexOf() is ______________
c) The return type of the function startsWith( ) is _______________
d) The return type of the function compareTo is _______________
e) “KOTAK SCHOOL”.substring(4,9) _______________

17. a) [Link](“The Sum = " +a+b); if a =4, b =25


[Link](“The Sum = " + (a+b)); if a =4, b =25

18) Give the output of the following code: String A ="26.0", B="74.0";
double C= Double .parseDouble(A);
double D = Double .parseDouble(B);
[Link]((C+D));

19) intr x = ‘D’;


[Link](“m=” + m);

20) [Link]( “computer”.substring(1,4) );


[Link]( “hello” + “computer”.substring(5)) ;

*****************

You might also like