Q: What is the suffix used to represent a floating point number in Java?
Solution: float a = 1.345f; float b = 567.345678F;
Q: What is the precision after decimal points offered by a float data type in Java?
Solution: float interest = 24.123456f;
Q: A real number literal for floating point literal with a missing f or F suffix represents which data type?
Solution: float a = 1.23; //error //can not convert from double to float float b = 1.23F // works double c = 1.567; //works
Q: What is the suffix used to convert an int literal to long literal in Java?
Solution: int a = 987654; //works int b = 9876543210; //Out of range error long c = 9876543210;//Out of range error long d = 9876543210L; //works
Q: Which version of Java started offering unsigned int and unsigned long to represent very long numbers?
Solution: You have to use Object version of int and long namely Integer and Long to avail the feature. Using primitive data types, you can not create an unsigned int or unsigned long.
Q: Choose a correct statement about Java literal types.
Solution: Hexadecimal literal uses Base 16 number system.
Q: A String literal in Java is surrounded by a pair of _____?
Solution: String name = "JAVA HERO";
Q: Which among the following is not a primitive data type in Java?
Solution: A string is a Class that can handle a string of characters or a group of characters. If the name of the type starts with an Uppercase letter, it is a Class. So it is non-primitive.
Q: Which version of Java introduced Hexadecimal floating point numbers?
Solution: float a = 0x3.1p0f; // 3.0625 //3 x p0 = 3 x 2^0 = 3 //(0.1)/16 = 0.0625
You Have Score    | /9 |