Advertisements
Advertisements
Question
int x = 98; char ch = (char)x; what is the value in ch?
Options
b
A
B
97
Advertisements
Solution
b
Explanation:
'A' has an ASCII value of 97; hence, ' B' has an ASCII value of 98.
APPEARS IN
RELATED QUESTIONS
Write the return data type of the following function:
endsWith( )
Give the output of the following string methods.
"MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I')
The output of the function "COMPOSITION". substring(3, 6):
Give the output of the following String class method:
"COMMENCEMENT".lastIndexOf('M')Give the output of the following String class method:
"devote". compareTo("DEVOTE")Define a class to accept a String and print the number of digits, alphabets and special characters in the string.
| Example: | S = "KAPILDEV@83" |
| Output: | Number of digits - 2 ' Number of Alphabets - 8 Number of Special characters - 1 |
The output of the statement "CONCENTRATION" indexOf('T') is ______.
The output of the statement "talent". compareTo("genius") is ______.
Consider the array given below:
char ch[]={'A','E','I','O','U'};
Write the output of the following statements:
System.out.println(ch[0]*2);;Write the output of the following String methods:
String x="Galaxy",y="Games";
(a) System.out.println(x.charAt(0)==y.charAt(0));
(b) System.out.println(x.compareTo(y));