Test Series - java

Test Number 9/64

Q: Underscore symbols in literal numbers are introduced with which version of Java?
A. JDK 5
B. JDK 6
C. JDK 7
D. JDK 8
Solution: 
Q: What is the prefix used to represent Binary literals in Java?
A. b or B
B. 0b or 0B
C. xB or xb
D. ob or oB
Solution: ZERO B or ZERO b
byte a = 0b00001111; //15 in decimal
Q: What is the correct representation of using Binary literals in Java?
A. int a = 0b1010;
B. int a = 0B1011_1010;
C. int a = 0B0______________1;
D. All the above
Solution: int a = 0B0______________1; //decimal=1
int b = 0b1010; //decimal=10
Q: What is the compiler error for improperly using Underscores ( _ ) in literals in Java?
A. Underscores are out of range
B. IllegalUnderscoresException
C. Underscores have to be located within digits
D. Too many Underscores
Solution: Underscore symbols cannot be used at the beginning and the end of digits of a number.
Q: Choose a correct rule for using Underscores in literals of Java language.
A. Underscores cannot come at the end of a number or next to the last digit of a number.
B. Underscores cannot come at the beginning of a number or before the first digit of a number.
C. Underscores cannot come before or after a decimal point in real numbers like float and double.
D. All the above
Solution: Also, there is no limit on the number of underscores between digits.
Q: What is the maximum number of Underscore characters that can be used in between the digits of a numeric literal in Java?
A. 8
B. 16
C. 32
D. No Limit
Solution: Theoretically, there is no limit on the number of underscores.
Q: Java uses UTF-16 Unicode format to represent characters. What is UTF?
A. Universal Transcript Format
B. Universal Transformation Format
C. Universal Technology Format
D. None of the above
Solution: Unicode contains 65535 characters.
Q: What is the name given to character literals in Java that start with a Back Slash character?
A. Back Slash Sequence
B. Slash Sequence
C. Escape Sequence
D. Extended Sequence
Solution:  = backspace

 = new line
\ = backslash
Q: What is the literal in Java that can be used to test whether an Object of any type is alive or not? 
A. alive
B. liveof
C. null
D. 0
Solution: String a;
if(a==null)
  System.out.println("Object destroyed");
Q: What is the common UTF standard used on the Websites for information exchange?
A. UTF 16
B. UTF 8
C. UTF 32
D. None of the above
Solution: UTF 16 character encoding standard used by Java language is used only by the Windows internal system and JavaScript Library. Unix, Linux and MacOS use UTF-8 encoding standard.

You Have Score    /10