Page 386 - Computer science 868 Class 12
P. 386
int x=Integer.parseInt(a);
int y=Integer.valueOf(b);
System.out.print(x+y+ " : " );
System.out.println(a+b);
a. 30 : 1020 b. 30 : 1022
c. 31 : 1020 d. 40 : 4020
5. Find the output of the following program snippet:
char ch = '*';
boolean b = Character.isLetter(ch);
System.out.println(b);
a. TRUE b. false
c. True d. False
6. char ch ;
int x=97;
do
{
ch=(char)x;
System.out.print(ch + " " );
if(x%10 == 0)
break;
++x;
} while(x<=100);
a. a b c d b. b c d e
c. A B C D d. None of these
7. What data type does concat() method returns?
a. double b. char
c. String d. None of these
8. “India”.compareTo(“india”) will return.
a. false b. -32
c. 32 d. None of these
9. Character.isLowerCase(ch) – what does this function do?
a. Changes the capital letters to small letters b. Does not change the uppercase to lowercase
c. Checks whether character is in lowercase or not d. Incorrect method
B. Fill in the blanks:
1. ASCII value of space (‘ ’) is ………………… .
2. toLowerCase() returns a ………………… .
3. String str = "Computer Science – Class XII";
String extractstr = str.substring(9,16);
System.out.println(extractstr);
The output will be ………………… .
4. String str1 = "INDIA";
String str2 = "INDIA";
int value = str1.compareTo(str2);
System.out.println("Value : "+ value);
The out put will be ………………… .
5. StringBuffer function that is used for deleting a character for a range of index in the given string is ………………… .
6. ………………… is the same as nextToken() but its return type is Object.
7. ………………… class breaks a sentence into tokens (sequence of characters except delimiters) or words.
8. ………………… method is same as the compareTo() method with a difference that it is not case-sensitive.
9. String str = "Rimi is good in dancing";
String replacestr= str.replace('i', 'a');
Output will be ………………… .
384384 Touchpad Computer Science-XII

