Que- What is the range of short data type in Java?
a. -128 to 127
b. -32768 to 32767
c. -2147483648 to 2147483647
d. None of the mentioned
Answer- -32768 to 32767
Que- What is the range of byte data type in Java?
a. -128 to 127
b. -32768 to 32767
c. -2147483648 to 2147483647
d. None of the mentioned
Answer- -128 to 127
Que- Which of the following are legal lines of Java code? 1. int w = (int)888.8; 2. byte x = (byte)100L; 3. long y = (byte)100; 4. byte z = (byte)100L;
a. 1 and 2
b. 2 and 3
c. 3 and 4
d. All statements are correct
Answer- All statements are correct
Que- An expression involving byte, int, and literal numbers is promoted to which of these?
a. int
b. long
c. byte
d. float
Answer- int
Que- Which data type value is returned by all transcendental math functions?
a. int
b. float
c. double
d. long
Answer- double
Que- What is the numerical range of a char data type in Java?
a. -128 to 127
b. 0 to 256
c. 0 to 32767
d. 0 to 65535
Answer- 0 to 65535
Que- What is the order of variables in Enum?
a. Ascending order
b. Descending order
c. Random order
d. Depends on the order() method
Answer- Ascending order
Que- If we try to add Enum constants to a TreeSet, what sorting order will it use?
a. Sorted in the order of declaration of Enums
b. Sorted in alphabetical order of Enums
c. Sorted based on order() method
d. Sorted in descending order of names of Enums
Answer- Sorted in the order of declaration of Enums
Que- Which method returns the elements of Enum class?
a. getEnums()
b. getEnumConstants()
c. getEnumList()
d. getEnum()
Answer- getEnumConstants()
Que- Which class does all the Enums extend?
a. Object
b. Enums
c. Enum
d. EnumClass
Answer- Enum
Que- Which of the following is the advantage of BigDecimal over double?
a. Syntax
b. Memory usage
c. Garbage creation
d. Precision
Answer- Precision
Que- Which of the below data type doesn’t support overloaded methods for +,-,* and /?
a. int
b. float
c. double
d. BigDecimal
Answer- BigDecimal
Que- What is the base of BigDecimal data type?
a. Base 2
b. Base 8
c. Base 10
d. Base e
Answer- Base 10
Que- What is the limitation of toString() method of BigDecimal?
a. There is no limitation
b. toString returns null
c. toString returns the number in expanded form
d. toString uses scientific notation
Answer- toString uses scientific notation
Que- Which of the following is not provided by BigDecimal?
a. scale manipulation
b. + operator
c. rounding
d. hashing
Answer- + operator
Que- BigDecimal is a part of which package?
a. java.lang
b. java.math
c. java.util
d. java.io
Answer- java.math
Que- What is BigDecimal.ONE?
a. wrong statement
b. custom defined statement
c. static variable with value 1 on scale 10
d. static variable with value 1 on scale 0
Answer- static variable with value 1 on scale 0
Que- Which class is a library of functions to perform arithmetic operations of BigInteger and BigDecimal?
a. MathContext
b. MathLib
c. BigLib
d. BigContext
Answer- MathContext