 Java All : String Class Functions Exam Paper Problems #### Using Math.pow and indexOf #3964

( As In Exam - ICSE2015 )

What is the value stored in variable res given below:
double res = Math

What is the value stored in variable res given below:
double res = Math.pow(“345”.indexOf(‘5’), 3);

#### Use of substring, toUpperCase and equalsIgnoreCase() #3980

( As In Exam - ICSE2015 )

State the output of the following  program segment is executed :

```St

```

State the output of the following  program segment is executed :

```String a = "Smartphone", b = "Graphic Art";
String h = a.substring(2, 5);
String k = b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h));```

#### Identifying functions by description #3984

( As In Exam - ICSE2015 )

(i) Name the mathematical function which is used to find sine of an angle giv

(i) Name the mathematical function which is used to find sine of an angle given in radians
(ii) Name a string function which removes the blank spaces provided in the prefix and suffix of a string

#### writing return data types endsWith() log() #4048

( As In Exam - ICSE2018 )

Write the return data type of the following function.
(i) endsWith()

Write the return data type of the following function.
(i) endsWith()
(ii)log()

#### replace() compareTo() #4063

( As In Exam - ICSE2018 )

Give the output of the following string functions:
(i) “ACHIEVEME

Give the output of the following string functions:
(i) “ACHIEVEMENT”.replace(‘E’,’A’)
(ii)”DEDICATE”.compareTo(“DEVOTE”)

#### array.length() and substring() #4065

( As In Exam - ICSE2018 )

Consider the following String array and give the output
String arr[]= {

Consider the following String array and give the output
String arr[]= {“DELHI”, “CHENNAI”, “MUMBAI”, “LUCKNOW”, “JAIPUR”};
System.out.println(arr.length()>arr.length());
System.out.print(arr.substring(0,3));

#### difference between == and equals() #4220

( As In Exam - ICSE2016 )

State the difference between == operator and equals() method.

State the difference between == operator and equals() method.

#### indexOf lastIndexOf compareTo #4235

( As In Exam - ICSE2016 )

Give the output of the following string functions :
(i) “MISSISSIPPI�

Give the output of the following string functions :
(i) “MISSISSIPPI”.indexOf(‘S’) + “MISSISSIPPI”.lastIndexOf(‘I’)

#### isLetterOrDigit() replace() function #4256

( As In Exam - ICSE2016 )

Write the return type of the following library functions :
(i) isLetter

Write the return type of the following library functions :
(i) isLetterOrDigit(char)
(ii) replace(char,char)

#### Sentence to Title Case Conversion #7192

( As In Exam - ICSE2018 )

Write a program in Java to accept a string in lower case and change the first

Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string.
Sample input: we are in cyber world
Sample output: We Are In Cyber World

#### Output writing – indexOf, substring #7241

( As In Exam - ICSE2017 )

Write the output for the following:
String s=”Today is Test”

Write the output for the following:
String s=”Today is Test” ;
System.out.println(s.indexOf(‘T’));
System.out.println(s.substring(0,7) + ” ” +”Holiday”);

#### String class methods to separate file path, name and extension #7428

( As In Exam - ICSE2014 )

Write a program to assign a full path and file name as given below. Using lib

Write a program to assign a full path and file name as given below. Using library functions, extract and output the file path, file name and
file extension separately as shown.