1) Which of these operators can be used to concatenate two or more String objects? a) A. + b) B. += c) C. & d) D. || 2) Which of these method of class String is used to obtain length of String object? a) A. get() b) B. Sizeof() c) C. lengthof() d) D. length() 3) Which of these method of class String is used to extract a single character from a String object? a) A. CHARAT() b) B. charat() c) C. charAt() d) D. ChatAt() 4) Which of these method of class String is used to compare two String objects for their equality? a) A. equals() b) B. Equals() c) C. isequal() d) D. Isequal() 5) Which of these method of class String is used to check weather a given object starts with a particular string literal? a) A. startsWith() b) B. endsWith() c) C. Starts() d) D. ends() 6) Which of these data type value is returned by equals() method of String class? a) A. char b) B. int c) C. boolean d) D. All of the mentioned 7) Which of these method of class String is used to extract a substring from a String object? a) A. substring() b) B. Substring() c) C. SubString() d) D. None of the mentioned 8) What will s2 contain after following lines of code? String s1 = "one";String s2 = s1.concat("two) a) A. one b) B. two c) C. onetwo d) D. twoone 9) Which of these method of class String is used to remove leading and trailing whitespaces? a) startsWith() b) B. trim() c) C. Trim() d) D. doTrim() 10) Which of the following statement is correct? a) replace() method replaces all occurrences of one character in invoking string with another character. b) replace() method replaces only first occurances of a character in invoking string with another character. c) replace() method replaces all the characters in invoking string with another character. d) replace() replace() method replaces last occurrence of a character in invoking string with another character. 11) . Which of the following statement is correct? a) reverse() method reverses all characters b) reverseall() method reverses all characters. c) replace() method replaces first occurrence of a character in invoking string with another character. d) replace() method replaces last occurrence of a character in invoking string with another character 12) What will be the output of the following program code? a) A. true b) B. false c) C. 0 d) D. 1 13) What will be the output of the following program? a) A. false true b) B. false false c) C. true false d) D. true true 14) What could be output of the following fragment of code? a) A. true b) B. false c) C. 0 d) D. Compilation error e) E. Throws Exception 15) What could be output of the following fragment of code?Determine output: a) A. Throws an exception as string and int are not compatible for addition b) B. hellow9 c) C. 9hellow d) D. Compilation error e) E. None of these 16) toString() method is defined inExamveda Examveda a) A. java.lang.String b) B. java.lang.Object c) C. java.lang.util d) D. None of these 17) The String method compareTo() returns a) A. true b) B. false c) C. an int value d) D. 1 e) E. -1 18) String str1 = "abcde"; System.out.println(str1.substring(1, 3)); a) A. abc b) B. bc c) C. bcd d) D. abcd e) E. None of these 19) What is the output of the following println statement? String str1 = "Hellow"; System.out.println(str1.indexOf('t')); a) A. true b) B. false c) C. 1 d) D. -1 e) E. 0 20) what will be the output of the following program? a) A. one b) B. two c) C. onetwo d) D. twoone e) E. None of these 21) String str1 = "Kolkata".replace('k', 'a'); In the above statement, the effect on string Kolkata is a) A. The first occurrence of k is replaced by a. b) B. All characters k are replaced by a. c) C. All characters a are replaced by k. d) D. Displays error message 22) The class string belongs to ................. package. a) A. java.awt b) B. java.lang c) C. java.applet d) D. java.string 23) What will be the output? a) A. one.two.three. b) B. Compilation fails because of an error at line 3 c) C. Compilation fails because of an error at line 5 d) D. An exception is thrown at runtime. e) E. None of these

Табло

Визуален стил

Опции

Шаблон за превключване

Възстановяване на авто-записаната: ?