Page 436 - CA_Blue( J )_Class10
P. 436
MIND DRILL
Solved Questions
A. Tick ( ) the correct answer.
1. String is a ………………….
a. Class b. Data type
c. Object d. Interface
2. Which of the following keyword, is used to create the object of the String class dynamically?
a. object b. static
c. new d. public
3. From where the index value of the String object is started?
a. 0 b. 1
c. 2 d. 3
4. Which of the following methods returns the character in the given index?
a. charAt() b. indexOf()
c. substring() d. equals()
5. Which type of value the toLowerCase() method will return?
a. int b. char
c. String d. boolean
6. Which of the following methods is used to extract a set of characters from a string?
a. trim() b. equals()
c. length() d. substring()
7. Which of the following methods replaces all the occurrences of a character in the string with the provided character?
a. replace() b. charAt()
c. concat() d. None of these
8. What will be the output of the following statement:
System.out.println("Orange Education".substring(7));
a. Orange b. Education
c. Orange Education d. Nothing will print
9. Which of the following is the return type of the startsWith() method?
a. int b. double
c. boolean d. char
10. Which of the following methods is used to delete the leading and trailing spaces from the current String object?
a. endsWith() b. trim()
c. space() d. equals()
11. Which of the following statements is true about strings in Java?
a. Strings are mutable. b. Strings are immutable.
c. Strings are primitive data types. d. Strings can be null but not empty.
12. What is the result of the following code snippet?
String str1 = "Hello";
String str2 = "Hello";
System.out.println(str1.equalsIgnoreCase(str2)==false);
a. true b. false
c. Compilation error d. Runtime error
434434 Touchpad Computer Applications-X

