Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Core Java - Interview Questions and Answers for 'Data type' - 38 question(s) found - Order By Rating | ||||
| ||||
Ans. BigDecimal provides more precision as compared to double. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  BigDecimal  Double  data types | ||||
| ||||
Ans. ambiguity error | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  code  method  function  data types Asked in 1 Companies | ||||
| ||||
Ans. if you have similar type of data or objects or entities, then we can give them a type with unique name. And this name will be our Data type. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data type | ||||
| ||||
Ans. 5.0 operation between two ints generate int only. so 7/5 generates 1 and not 1.4. Multiplication between int and float generates float and hence 1 * 5.0 = 5.0 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  arithmetic calculation  data types | ||||
| ||||
Ans. char is a primitive data type. String is a class. Char is a wrapper class for primitive char. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  char  string  data type Basic | ||||
| ||||
Ans. String is not a primitive type in java. Anything defined within double quotes like "abc" is an object of String class. | ||||
Sample Code for String | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  string  data type Basic | ||||
| ||||
Ans. Boxing conversion converts expressions of primitive type to corresponding expressions of reference type. For example boolean to Boolean long to Long double to Double | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data type  boxing  wrapper classes | ||||
| ||||
Ans. Conversion means that the expression / literal / value of one type getting converted to other type. Widening conversion is the conversion from Type A to Type B where B requires a wider space than A. For example - int to long, float to double, char to String etc. As the value moves to a wider space, there is no loss of information. Narrowing conversion is the conversion from Type A to Type B where B requires a narrower space space than A. For example - int to long, float to double, char to String etc.As the value moves to a narrower space, there is a loss of information. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data type  widening conversion  narrowing conversion | ||||
| ||||
Ans. Both holds numeric values. short is a 16-bit signed two's complement integer whereas int is a 32-bit signed two's complement integer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types  short vs int | ||||
| ||||
Ans. boolean byte char double float int long short void | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types  primitive data types Asked in 1 Companies Basic | ||||
| ||||
Ans. It uses those low order bytes of the result that can fit into the size of the type allowed by the operation. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  integer  data types Asked in 1 Companies   rare | ||||
| ||||
Ans. Because the way float values are stored its not precise. For example - 0.1 is actually stored as 0.1000000000000000055511151231257827021181583404541015625 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  double  float  data type basic   frequent | ||||
| ||||
Ans. At Application level we use either Double or BigDecimal , preferably BigDecimal. At Database level we use Number with decimal precision 3. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types | ||||
| ||||
Ans. boolean - java.lang.Boolean byte - java.lang.Byte char - java.lang.Character double - java.lang.Double float - java.lang.Float int - java.lang.Integer long - java.lang.Long short - java.lang.Short void - java.lang.Void | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java5   data types   wrapper classes   adapter design pattern   rare | ||||
| ||||
Ans. They both represent the long primitive type. They are exactly the same. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   long.Class   long.TYPE   advanced expert   rare | ||||
| ||||
Ans. They are wrappers to primitive data types. They allow us to access primitives as objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   wrapper classes Asked in 3 Companies basic   frequent | ||||
| ||||
Ans. There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   casting  type casting   basic interview question Asked in 8 Companies basic   frequent | ||||
| ||||
Ans. boolean ---> false byte ----> 0 short ----> 0 int -----> 0 long ------> 0l char -----> /u0000 float ------> 0.0f double ----> 0.0d any object reference ----> null | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   default values | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Float can represent up to 7 digits accurately after decimal point, where as double can represent up to 15 digits accurately after decimal point. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   float   double   difference between   basic interview question | ||||
| ||||
Ans. Generalization or UpCasting is a phenomenon where a sub class is prompted to a super class, and hence becomes more general. Generalization needs widening or up-casting. Specialization or DownCasting is a phenomenon where a super class is narrowed down to a sub class. Specialization needs narrowing or down-casting. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   casting  type casting   up casting  type casting   downcasting  type casting   generalization   specialization Asked in 2 Companies | ||||
| ||||
Ans. Variables used in a switch statement can only be a byte, short, int, or char ( and String with Java 7 and above ) | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   switch   variable   data type basic   rare | ||||
| ||||
Ans. The default value of the boolean type is false. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data type   boolean   initialization   default object construction   default constructor   default value | ||||
| ||||
Ans. http://www.buggybread.com/2015/02/java-util-classes-that-inherit-number.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   number class | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-double-classes-and_31.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   boolean | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-double-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   double | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-float-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   float | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-integer-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   integer | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-long-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   long | ||||
| ||||
Ans. Data type: a set of values together with operations on that type Data structure: a physical implementation of a data type | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   data structure   data type | ||||
| ||||
Ans. No. Data Type holds data whereas Interface doesn't hold anything. Interface is a contract about how to communicate with the underlying Class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   interface   data type | ||||