529). Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.
[A] get()
[B] getVhar()
[C]charValue()
[D]getCharacter()
Show Answer
Correct Answer: charValue()
Notes:
Answer: c
Explanation: To obtain the char value contained in a Character object, we use charValue() method.
530). Which of the following constant are defined in Character wrapper?
[A]MAX_RADIX
[B] MAX_VALUE
[C]TYPE
[D]All of the mentioned
Show Answer
Correct Answer: All of the mentioned
Notes:
Answer: d
Explanation: Character wrapper defines 5 constants – MAX_RADIX, MIN_RADIX, MAX_VALUE, MIN_VALUE & TYPE.
531). Which of these is a super class of Character wrapper?
[A]Long
[B]Digits
[C]Float
[D]Number
Show Answer
Correct Answer: Number
Notes:
Answer: d
Explanation: Number is an abstract class containing subclasses Double, Float, Byte, Short, Character, Integer and Long.
532). Which of these methods is used to know whether a given Character object is part of Java’s Identifiers?
[A]isIdentifier()
[B] isJavaIdentifier()
[C] isJavaIdentifierPart()
[D]none of the mentioned
Show Answer
Correct Answer: isJavaIdentifierPart()
Notes:
Answer: c
Explanation: None.
533). Which of these coding techniques is used by method isDefined()?
[A]Latin
[B]ASCII
[C]ANSI
[D]UNICODE
Show Answer
Correct Answer: UNICODE
Notes:
Answer: d
Explanation: isDefined() returns true if ch is defined by Unicode. Otherwise, it returns false.
534). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int a = Character.MAX_VALUE;
System.out.print((char)a);
}
}
Show Answer
Correct Answer: ?
Notes:
Answer: c
Explanation: Character.MAX_VALUE returns the largest character value, which is of character ‘?’.
Output:$ javac Output.java
$ java Output
?
535). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int a = Character.MIN_VALUE;
System.out.print((char)a);
}
}
Show Answer
Correct Answer: Space
Notes:
Answer: d
Explanation: Character.MIN_VALUE returns the smallest character value, which is of space character ‘ ‘.
Output:
$ javac Output.java
$ java Output
536). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0])+ " ");
System.out.print(Character.isWhitespace(a[3])+ " ");
System.out.print(Character.isUpperCase(a[2]));
}
}
[A]true false true
[B]false true true
[C] true true false
[D] false false false
Show Answer
Correct Answer: false true true
Notes:
Answer: b
Explanation: Character.isDigit(a[0]) checks for a[0], whether it is a digit or not, since a[0] i:e ‘a’ is a character false is returned. a[3] is a whitespace hence Character.isWhitespace(a[3]) returns a true. a[2] is an uppercase letter i:e ‘A’ hence Character.isUpperCase(a[2]) returns true.
Output:
$ javac Output.java
$ java Output
false true true
537). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
char a = (char) 98;
a = Character.toUpperCase(a);
System.out.print(a);
}
}
Show Answer
Correct Answer: C
Notes:
Answer: c
Explanation: None.
Output:
$ javac Output.java
$ java Output
B
538). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
char a = '@';
boolean x = Character.isLetter(a);
System.out.print(x);
}
}
[A]true
[B]false
[C]@
[D]B
Show Answer
Correct Answer: false
Notes:
Answer: b
Explanation: None.
Output:
$ javac Output.java
$ java Output
false